Go to the documentation of this file.
6 #ifndef ABTI_YTHREAD_H_INCLUDED
7 #define ABTI_YTHREAD_H_INCLUDED
13 #ifndef ABT_CONFIG_DISABLE_ERROR_CHECK
28 #ifndef ABT_CONFIG_DISABLE_ERROR_CHECK
30 if (p_ythread == NULL) {
47 #if ABT_CONFIG_THREAD_TYPE == ABT_THREAD_TYPE_DYNAMIC_PROMOTION
134 LOG_DEBUG(
"[U%" PRIu64
"] dynamic-promote ULT\n",
136 void *p_stack = p_ythread->
p_stack;
138 void *p_stacktop = (
void *)(((
char *)p_stack) + stacksize);
147 #if ABT_CONFIG_THREAD_TYPE == ABT_THREAD_TYPE_DYNAMIC_PROMOTION
168 *pp_local_xstream = p_local_xstream;
170 p_local_xstream->p_thread = &p_old->
thread;
181 #if ABT_CONFIG_THREAD_TYPE == ABT_THREAD_TYPE_DYNAMIC_PROMOTION
200 *pp_local_xstream = p_local_xstream;
202 p_local_xstream->p_thread = &p_old->
thread;
216 #if ABT_CONFIG_THREAD_TYPE == ABT_THREAD_TYPE_DYNAMIC_PROMOTION
222 LOG_DEBUG(
"[U%" PRIu64
"] run ULT (dynamic promotion)\n",
224 p_local_xstream = *pp_local_xstream;
225 p_local_xstream->p_thread = &p_new->
thread;
237 *pp_local_xstream = p_local_xstream;
238 ABTI_thread *p_prev_thread = p_local_xstream->p_thread;
241 p_local_xstream->p_thread = &p_old->
thread;
272 #ifndef ABT_CONFIG_ACTIVE_WAIT_POLICY
300 *pp_local_xstream = p_local_xstream;
302 p_local_xstream->p_thread = &p_old->
thread;
309 #ifdef ABT_CONFIG_ENABLE_PEEK_CONTEXT
310 static inline void ABTI_ythread_context_peek(
ABTI_ythread *p_ythread,
311 void (*peek_func)(
void *),
314 #if ABT_CONFIG_THREAD_TYPE == ABT_THREAD_TYPE_DYNAMIC_PROMOTION
320 ABTD_ythread_context_peek(&p_ythread->
ctx, peek_func, arg);
387 sync_event_type, p_sync);
390 LOG_DEBUG(
"[U%" PRIu64
":E%d] resume after yield\n",
static ABTI_ythread * ABTI_ythread_context_switch_to_parent_internal(ABTI_xstream **pp_local_xstream, ABTI_ythread *p_old, ABT_bool is_finish, ABT_sync_event_type sync_event_type, void *p_sync)
int ABT_bool
Boolean type.
#define ABTI_THREAD_REQ_TERMINATE
static ABTI_ythread * ABTI_ythread_get_ptr(ABT_thread thread)
struct ABT_thread_opaque * ABT_thread
Work unit handle type.
static ABTI_ythread * ABTI_ythread_context_switch_to_sibling(ABTI_xstream **pp_local_xstream, ABTI_ythread *p_old, ABTI_ythread *p_new)
#define ABTI_THREAD_TYPE_YIELDABLE
ABTD_atomic_uint32 request
static ABTI_ythread * ABTI_thread_get_ythread(ABTI_thread *p_thread)
ABT_unit_id ABTI_thread_get_id(ABTI_thread *p_thread)
ABTD_ythread_context_atomic_ptr p_link
static ABT_thread ABTI_ythread_get_handle(ABTI_ythread *p_ythread)
#define ABTI_THREAD_TYPE_EXT
static ABTI_ythread * ABTI_ythread_context_get_ythread(ABTD_ythread_context *p_ctx)
#define LOG_DEBUG(fmt,...)
static ABTI_ythread * ABTI_ythread_context_switch_to_child_internal(ABTI_xstream **pp_local_xstream, ABTI_ythread *p_old, ABTI_ythread *p_new)
#define ABTI_ASSERT(cond)
static ABTU_noreturn void ABTI_ythread_finish_context_to_parent(ABTI_xstream *p_local_xstream, ABTI_ythread *p_old)
static ABTI_ythread * ABTI_ythread_context_switch_to_parent(ABTI_xstream **pp_local_xstream, ABTI_ythread *p_old, ABT_sync_event_type sync_event_type, void *p_sync)
static ABTI_local * ABTI_local_get_local_uninlined(void)
static void ABTI_ythread_dynamic_promote_ythread(ABTI_ythread *p_ythread)
static ABTI_local * ABTI_xstream_get_local(ABTI_xstream *p_xstream)
#define ABT_TRUE
True constant for ABT_bool.
static void ABTD_ythread_context_arm_ythread(size_t stacksize, void *p_stack, ABTD_ythread_context *p_newctx)
void ABTD_futex_resume(ABTD_futex_single *p_futex)
static ABT_bool ABTD_ythread_context_is_dynamic_promoted(ABTD_ythread_context *p_ctx)
static void ABTD_ythread_context_dynamic_promote_ythread(void *p_stacktop)
#define ABT_FALSE
False constant for ABT_bool.
void ABTI_ythread_set_ready(ABTI_local *p_local, ABTI_ythread *p_ythread)
static void ABTD_ythread_context_switch(ABTD_ythread_context *p_old, ABTD_ythread_context *p_new)
static uint32_t ABTD_atomic_fetch_or_uint32(ABTD_atomic_uint32 *ptr, uint32_t v)
static ABTI_ythread * ABTI_ythread_context_switch_to_child(ABTI_xstream **pp_local_xstream, ABTI_ythread *p_old, ABTI_ythread *p_new)
ABTI_xstream * p_last_xstream
static ABTU_noreturn void ABTI_ythread_finish_context_to_sibling(ABTI_xstream *p_local_xstream, ABTI_ythread *p_old, ABTI_ythread *p_new)
struct ABTI_local ABTI_local
static ABT_bool ABTI_ythread_is_dynamic_promoted(ABTI_ythread *p_ythread)
static void ABTI_ythread_yield(ABTI_xstream **pp_local_xstream, ABTI_ythread *p_ythread, ABT_sync_event_type sync_event_type, void *p_sync)
static ABTU_noreturn void ABTD_ythread_finish_context(ABTD_ythread_context *p_old, ABTD_ythread_context *p_new)
static void ABTD_atomic_release_store_uint32(ABTD_atomic_uint32 *ptr, uint32_t val)
static void ABTD_ythread_context_make_and_call(ABTD_ythread_context *p_old, void(*f_thread)(void *), void *p_arg, void *p_stacktop)
static ABTI_xstream * ABTI_local_get_xstream(ABTI_local *p_local)
static ABTU_noreturn void ABTU_unreachable(void)
static ABTI_ythread * ABTI_ythread_context_switch_to_sibling_internal(ABTI_xstream **pp_local_xstream, ABTI_ythread *p_old, ABTI_ythread *p_new, ABT_bool is_finish)
static void ABTD_atomic_release_store_int(ABTD_atomic_int *ptr, int val)
static ABTD_ythread_context * ABTD_atomic_acquire_load_ythread_context_ptr(const ABTD_ythread_context_atomic_ptr *ptr)
#define ABTI_THREAD_REQ_JOIN