ARGOBOTS
abti_thread_attr.h
Go to the documentation of this file.
1 /* -*- Mode: C; c-basic-offset:4 ; indent-tabs-mode:nil ; -*- */
2 /*
3  * See COPYRIGHT in top-level directory.
4  */
5 
6 #ifndef ABTI_THREAD_ATTR_H_INCLUDED
7 #define ABTI_THREAD_ATTR_H_INCLUDED
8 
9 /* Inlined functions for ULT Attributes */
10 
22 static inline ABTI_thread_attr *ABTI_thread_attr_get_ptr(ABT_thread_attr attr)
23 {
24 #ifndef ABT_CONFIG_DISABLE_ERROR_CHECK
25  ABTI_thread_attr *p_attr;
26  if (attr == ABT_THREAD_ATTR_NULL) {
27  p_attr = NULL;
28  } else {
29  p_attr = (ABTI_thread_attr *)attr;
30  }
31  return p_attr;
32 #else
33  return (ABTI_thread_attr *)attr;
34 #endif
35 }
36 
48 static inline ABT_thread_attr
49 ABTI_thread_attr_get_handle(ABTI_thread_attr *p_attr)
50 {
51 #ifndef ABT_CONFIG_DISABLE_ERROR_CHECK
52  ABT_thread_attr h_attr;
53  if (p_attr == NULL) {
54  h_attr = ABT_THREAD_ATTR_NULL;
55  } else {
56  h_attr = (ABT_thread_attr)p_attr;
57  }
58  return h_attr;
59 #else
60  return (ABT_thread_attr)p_attr;
61 #endif
62 }
63 
64 #ifndef ABT_CONFIG_DISABLE_MIGRATION
65 static inline void ABTI_thread_attr_init_migration(ABTI_thread_attr *p_attr,
66  ABT_bool migratable)
67 {
68  p_attr->migratable = migratable;
69  p_attr->f_cb = NULL;
70  p_attr->p_cb_arg = NULL;
71 }
72 #endif
73 
74 static inline void ABTI_thread_attr_init(ABTI_thread_attr *p_attr,
75  void *p_stack, size_t stacksize,
76  ABTI_stack_type stacktype,
77  ABT_bool migratable)
78 {
79  p_attr->p_stack = p_stack;
80  p_attr->stacksize = stacksize;
81  p_attr->stacktype = stacktype;
82 #ifndef ABT_CONFIG_DISABLE_MIGRATION
83  ABTI_thread_attr_init_migration(p_attr, migratable);
84 #endif
85 }
86 
87 static inline void ABTI_thread_attr_copy(ABTI_thread_attr *p_dest,
88  ABTI_thread_attr *p_src)
89 {
90  memcpy(p_dest, p_src, sizeof(ABTI_thread_attr));
91 }
92 
93 #endif /* ABTI_THREAD_ATTR_H_INCLUDED */
struct ABT_thread_attr_opaque * ABT_thread_attr
Definition: abt.h:281
int ABT_bool
Definition: abt.h:309
#define ABT_THREAD_ATTR_NULL
Definition: abt.h:345