6 #ifndef ABTD_CONTEXT_H_INCLUDED 7 #define ABTD_CONTEXT_H_INCLUDED 11 #ifndef ABT_CONFIG_USE_FCONTEXT 16 typedef struct ABTD_thread_context ABTD_thread_context;
18 typedef struct ABTD_thread_context_atomic_ptr {
20 } ABTD_thread_context_atomic_ptr;
22 static inline ABTD_thread_context *ABTD_atomic_relaxed_load_thread_context_ptr(
23 const ABTD_thread_context_atomic_ptr *ptr)
25 return (ABTD_thread_context *)ABTD_atomic_relaxed_load_ptr(&ptr->val);
28 static inline ABTD_thread_context *ABTD_atomic_acquire_load_thread_context_ptr(
29 const ABTD_thread_context_atomic_ptr *ptr)
31 return (ABTD_thread_context *)ABTD_atomic_acquire_load_ptr(&ptr->val);
34 static inline void ABTD_atomic_relaxed_store_thread_context_ptr(
35 ABTD_thread_context_atomic_ptr *ptr, ABTD_thread_context *p_ctx)
37 ABTD_atomic_relaxed_store_ptr(&ptr->val, (
void *)p_ctx);
40 static inline void ABTD_atomic_release_store_thread_context_ptr(
41 ABTD_thread_context_atomic_ptr *ptr, ABTD_thread_context *p_ctx)
43 ABTD_atomic_release_store_ptr(&ptr->val, (
void *)p_ctx);
46 struct ABTD_thread_context {
49 void (*f_thread)(
void *);
51 ABTD_thread_context_atomic_ptr p_link;
52 #ifndef ABT_CONFIG_USE_FCONTEXT 54 void (*f_uctx_thread)(
void *);
59 static void ABTD_thread_context_make(ABTD_thread_context *p_ctx,
void *sp,
60 size_t size,
void (*thread_func)(
void *));
61 static void ABTD_thread_context_jump(ABTD_thread_context *p_old,
62 ABTD_thread_context *p_new,
void *arg);
63 static void ABTD_thread_context_take(ABTD_thread_context *p_old,
64 ABTD_thread_context *p_new,
void *arg);
65 #if ABT_CONFIG_THREAD_TYPE == ABT_THREAD_TYPE_DYNAMIC_PROMOTION 66 static void ABTD_thread_context_init_and_call(ABTD_thread_context *p_ctx,
68 void (*thread_func)(
void *),
72 void ABTD_thread_print_context(ABTI_thread *p_thread, FILE *p_os,
int indent);
74 #ifdef ABT_CONFIG_USE_FCONTEXT