29 ABTI_thread_attr *p_newattr;
31 p_newattr = (ABTI_thread_attr *)
ABTU_malloc(
sizeof(ABTI_thread_attr));
34 ABTI_thread_attr_init(p_newattr, NULL, ABTI_global_get_thread_stacksize(),
38 *newattr = ABTI_thread_attr_get_handle(p_newattr);
59 ABTI_thread_attr *p_attr = ABTI_thread_attr_get_ptr(h_attr);
60 ABTI_CHECK_NULL_THREAD_ATTR_PTR(p_attr);
101 ABTI_thread_attr *p_attr = ABTI_thread_attr_get_ptr(attr);
102 ABTI_CHECK_NULL_THREAD_ATTR_PTR(p_attr);
104 if (stackaddr != NULL) {
105 if (((uintptr_t)stackaddr & 0x7) != 0) {
109 p_attr->p_stack = stackaddr;
110 p_attr->stacktype = ABTI_STACK_TYPE_USER;
112 p_attr->stacktype = ABTI_STACK_TYPE_MALLOC;
114 p_attr->stacksize = stacksize;
144 ABTI_thread_attr *p_attr = ABTI_thread_attr_get_ptr(attr);
145 ABTI_CHECK_NULL_THREAD_ATTR_PTR(p_attr);
147 *stackaddr = p_attr->p_stack;
148 *stacksize = p_attr->stacksize;
173 ABTI_thread_attr *p_attr = ABTI_thread_attr_get_ptr(attr);
174 ABTI_CHECK_NULL_THREAD_ATTR_PTR(p_attr);
177 p_attr->stacksize = stacksize;
202 ABTI_thread_attr *p_attr = ABTI_thread_attr_get_ptr(attr);
203 ABTI_CHECK_NULL_THREAD_ATTR_PTR(p_attr);
205 *stacksize = p_attr->stacksize;
233 #ifndef ABT_CONFIG_DISABLE_MIGRATION 235 ABTI_thread_attr *p_attr = ABTI_thread_attr_get_ptr(attr);
236 ABTI_CHECK_NULL_THREAD_ATTR_PTR(p_attr);
239 p_attr->f_cb = cb_func;
240 p_attr->p_cb_arg = cb_arg;
271 #ifndef ABT_CONFIG_DISABLE_MIGRATION 273 ABTI_thread_attr *p_attr = ABTI_thread_attr_get_ptr(attr);
274 ABTI_CHECK_NULL_THREAD_ATTR_PTR(p_attr);
277 p_attr->migratable = flag;
311 void ABTI_thread_attr_print(ABTI_thread_attr *p_attr, FILE *p_os,
int indent)
316 ABTI_thread_attr_get_str(p_attr, attr);
317 fprintf(p_os,
"%sULT attr: %s\n", prefix, attr);
322 void ABTI_thread_attr_get_str(ABTI_thread_attr *p_attr,
char *p_buf)
324 if (p_attr == NULL) {
325 sprintf(p_buf,
"[NULL ATTR]");
330 switch (p_attr->stacktype) {
331 case ABTI_STACK_TYPE_MEMPOOL:
332 stacktype =
"MEMPOOL";
334 case ABTI_STACK_TYPE_MALLOC:
335 stacktype =
"MALLOC";
337 case ABTI_STACK_TYPE_USER:
340 case ABTI_STACK_TYPE_MAIN:
344 stacktype =
"UNKNOWN";
348 #ifndef ABT_CONFIG_DISABLE_MIGRATION 357 p_attr->p_stack, p_attr->stacksize, stacktype,
358 (p_attr->migratable ==
ABT_TRUE ?
"TRUE" :
"FALSE"),
367 p_attr->p_stack, p_attr->stacksize, stacktype);
371 ABTI_thread_attr *ABTI_thread_attr_dup(ABTI_thread_attr *p_attr)
373 ABTI_thread_attr *p_dupattr;
375 p_dupattr = (ABTI_thread_attr *)
ABTU_malloc(
sizeof(ABTI_thread_attr));
376 ABTI_thread_attr_copy(p_dupattr, p_attr);
struct ABT_thread_attr_opaque * ABT_thread_attr
char * ABTU_get_indent_str(int indent)
int ABT_thread_attr_set_stacksize(ABT_thread_attr attr, size_t stacksize)
Set the stack size in the attribute object.
int ABT_thread_attr_set_stack(ABT_thread_attr attr, void *stackaddr, size_t stacksize)
Set stack attributes.
int ABT_thread_attr_set_migratable(ABT_thread_attr attr, ABT_bool flag)
Set the ULT's migratability in the attribute object.
int ABT_thread_attr_get_stacksize(ABT_thread_attr attr, size_t *stacksize)
Get the stack size from the attribute object.
int ABT_thread_attr_set_callback(ABT_thread_attr attr, void(*cb_func)(ABT_thread thread, void *cb_arg), void *cb_arg)
Set callback function and its argument in the attribute object.
static void * ABTU_malloc(size_t size)
int ABT_thread_attr_create(ABT_thread_attr *newattr)
Create a new ULT attribute object.
struct ABT_thread_opaque * ABT_thread
#define HANDLE_ERROR_FUNC_WITH_CODE(n)
#define ABT_THREAD_ATTR_NULL
int ABT_thread_attr_get_stack(ABT_thread_attr attr, void **stackaddr, size_t *stacksize)
Get stack attributes.
int ABT_thread_attr_free(ABT_thread_attr *attr)
Free the ULT attribute object.
#define ABT_ERR_FEATURE_NA
static void ABTU_free(void *ptr)