6 #ifndef ABTD_THREAD_H_INCLUDED
7 #define ABTD_THREAD_H_INCLUDED
9 #if defined(ABT_C_HAVE_VISIBILITY)
10 #define ABT_API_PRIVATE __attribute__((visibility("hidden")))
12 #define ABT_API_PRIVATE
16 #if ABT_CONFIG_THREAD_TYPE == ABT_THREAD_TYPE_DYNAMIC_PROMOTION
21 size_t stacksize,
void *p_stack,
29 p_stacktop = (
void *)(((
char *)p_stack) + stacksize);
41 #if ABT_CONFIG_THREAD_TYPE == ABT_THREAD_TYPE_DYNAMIC_PROMOTION
44 p_newctx->
p_ctx = (
void *)((intptr_t)0x1);
46 p_newctx->
p_ctx = NULL;
52 #if ABT_CONFIG_THREAD_TYPE == ABT_THREAD_TYPE_DYNAMIC_PROMOTION
57 p_newctx->
p_ctx = NULL;
73 void *p_stacktop = (
void *)(((
char *)p_stack) + stacksize);
81 #define ABTD_thread_context_free(p_ctx)
96 #if ABT_CONFIG_THREAD_TYPE == ABT_THREAD_TYPE_DYNAMIC_PROMOTION
98 void (*f_thread)(
void *),
117 void **p_return_address = (
void **)(((
char *)p_stacktop) - 0x10);
118 void ***p_stack_pointer = (
void ***)(((
char *)p_stacktop) - 0x08);
119 *p_stack_pointer = p_return_address;
120 *p_return_address = jump_f;
130 void *jump_f = conv.ptr;
static void ABTD_thread_context_jump(ABTD_thread_context *p_old, ABTD_thread_context *p_new, void *arg)
static void ABTD_thread_context_init_and_call(ABTD_thread_context *p_ctx, void *sp, void(*thread_func)(void *), void *arg)
static void ABTDI_thread_context_dynamic_promote(void *p_stacktop, void *jump_f)
static ABT_bool ABTD_thread_context_is_dynamic_promoted(ABTD_thread_context *p_ctx)
static int ABTD_thread_context_invalidate(ABTD_thread_context *p_newctx)
static void ABTD_thread_context_make_and_call(ABTD_thread_context *p_old, void(*f_thread)(void *), void *p_arg, void *p_stacktop)
void ABTD_thread_func_wrapper(void *p_arg)
static void ABTD_atomic_relaxed_store_thread_context_ptr(ABTD_thread_context_atomic_ptr *ptr, ABTD_thread_context *p_ctx)
void ABTD_thread_terminate_no_arg()
static ABTU_noreturn void ABTD_thread_finish_context(ABTD_thread_context *p_old, ABTD_thread_context *p_new)
static void ABTD_thread_context_dynamic_promote_thread(void *p_stacktop)
static int ABTD_thread_context_create(ABTD_thread_context *p_link, size_t stacksize, void *p_stack, ABTD_thread_context *p_newctx)
static int ABTD_thread_context_arm_thread(size_t stacksize, void *p_stack, ABTD_thread_context *p_newctx)
ABTD_thread_context_atomic_ptr p_link
static void ABTD_thread_context_switch(ABTD_thread_context *p_old, ABTD_thread_context *p_new)
static ABTU_noreturn void ABTD_thread_context_take(ABTD_thread_context *p_old, ABTD_thread_context *p_new, void *arg)
static void ABTD_thread_context_make(ABTD_thread_context *p_ctx, void *sp, size_t size, void(*thread_func)(void *))
static int ABTD_thread_context_init(ABTD_thread_context *p_link, ABTD_thread_context *p_newctx)