6 #ifndef ABTI_EVENT_H_INCLUDED 
    7 #define ABTI_EVENT_H_INCLUDED 
    9 #if !defined(ABT_CONFIG_DISABLE_TOOL_INTERFACE) ||                             \ 
   10     defined(ABT_CONFIG_USE_DEBUG_LOG) 
   11 #define ABTI_ENABLE_EVENT_INTERFACE 1 
   13 #define ABTI_ENABLE_EVENT_INTERFACE 0 
   16 static inline void ABTI_event_thread_create_impl(ABTI_local *p_local,
 
   17                                                  ABTI_thread *p_thread,
 
   18                                                  ABTI_thread *p_caller,
 
   21 #ifdef ABT_CONFIG_USE_DEBUG_LOG 
   22     ABTI_log_debug_thread(
"create", p_thread);
 
   24 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE 
   31 static inline void ABTI_event_thread_join_impl(ABTI_local *p_local,
 
   32                                                ABTI_thread *p_thread,
 
   33                                                ABTI_thread *p_caller)
 
   35 #ifdef ABT_CONFIG_USE_DEBUG_LOG 
   36     ABTI_log_debug_thread(
"join", p_thread);
 
   38 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE 
   45 static inline void ABTI_event_thread_free_impl(ABTI_local *p_local,
 
   46                                                ABTI_thread *p_thread,
 
   47                                                ABTI_thread *p_caller)
 
   49 #ifdef ABT_CONFIG_USE_DEBUG_LOG 
   50     ABTI_log_debug_thread(
"free", p_thread);
 
   52 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE 
   59 static inline void ABTI_event_thread_revive_impl(ABTI_local *p_local,
 
   60                                                  ABTI_thread *p_thread,
 
   61                                                  ABTI_thread *p_caller,
 
   64 #ifdef ABT_CONFIG_USE_DEBUG_LOG 
   65     ABTI_log_debug_thread(
"revive", p_thread);
 
   67 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE 
   74 static inline void ABTI_event_thread_run_impl(ABTI_xstream *p_local_xstream,
 
   75                                               ABTI_thread *p_thread,
 
   77                                               ABTI_thread *p_parent)
 
   79 #ifdef ABT_CONFIG_USE_DEBUG_LOG 
   80     ABTI_log_debug_thread(
"run", p_thread);
 
   82 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE 
   83     ABTI_tool_event_thread(ABTI_xstream_get_local(p_local_xstream),
 
   89 static inline void ABTI_event_thread_finish_impl(ABTI_xstream *p_local_xstream,
 
   90                                                  ABTI_thread *p_thread,
 
   91                                                  ABTI_thread *p_parent)
 
   93 #ifdef ABT_CONFIG_USE_DEBUG_LOG 
   94     ABTI_log_debug_thread(
"finish", p_thread);
 
   96 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE 
   97     ABTI_tool_event_thread(ABTI_xstream_get_local(p_local_xstream),
 
  103 static inline void ABTI_event_thread_cancel_impl(ABTI_xstream *p_local_xstream,
 
  104                                                  ABTI_thread *p_thread)
 
  106 #ifdef ABT_CONFIG_USE_DEBUG_LOG 
  107     ABTI_log_debug_thread(
"cancel", p_thread);
 
  109 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE 
  110     ABTI_tool_event_thread(ABTI_xstream_get_local(p_local_xstream),
 
  117 ABTI_event_ythread_yield_impl(ABTI_xstream *p_local_xstream,
 
  118                               ABTI_ythread *p_ythread, ABTI_thread *p_parent,
 
  121 #ifdef ABT_CONFIG_USE_DEBUG_LOG 
  122     ABTI_log_debug_thread(
"yield", &p_ythread->thread);
 
  124 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE 
  125     ABTI_tool_event_thread(ABTI_xstream_get_local(p_local_xstream),
 
  127                            NULL, p_ythread->thread.p_pool, p_parent,
 
  128                            sync_event_type, p_sync);
 
  132 static inline void ABTI_event_ythread_suspend_impl(
 
  133     ABTI_xstream *p_local_xstream, ABTI_ythread *p_ythread,
 
  136 #ifdef ABT_CONFIG_USE_DEBUG_LOG 
  137     ABTI_log_debug_thread(
"suspend", &p_ythread->thread);
 
  139 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE 
  140     ABTI_tool_event_thread(ABTI_xstream_get_local(p_local_xstream),
 
  142                            NULL, p_ythread->thread.p_pool, p_parent,
 
  143                            sync_event_type, p_sync);
 
  147 static inline void ABTI_event_ythread_resume_impl(ABTI_local *p_local,
 
  148                                                   ABTI_ythread *p_ythread,
 
  149                                                   ABTI_thread *p_caller)
 
  151 #ifdef ABT_CONFIG_USE_DEBUG_LOG 
  152     ABTI_log_debug_thread(
"resume", &p_ythread->thread);
 
  154 #ifndef ABT_CONFIG_DISABLE_TOOL_INTERFACE 
  156                            &p_ythread->thread, p_caller,
 
  157                            p_ythread->thread.p_pool, NULL,
 
  162 #define ABTI_event_thread_create(p_local, p_thread, p_caller, p_pool)          \ 
  164         if (ABTI_ENABLE_EVENT_INTERFACE) {                                     \ 
  165             ABTI_event_thread_create_impl(p_local, p_thread, p_caller,         \ 
  170 #define ABTI_event_thread_join(p_local, p_thread, p_caller)                    \ 
  172         if (ABTI_ENABLE_EVENT_INTERFACE) {                                     \ 
  173             ABTI_event_thread_join_impl(p_local, p_thread, p_caller);          \ 
  177 #define ABTI_event_thread_free(p_local, p_thread, p_caller)                    \ 
  179         if (ABTI_ENABLE_EVENT_INTERFACE) {                                     \ 
  180             ABTI_event_thread_free_impl(p_local, p_thread, p_caller);          \ 
  184 #define ABTI_event_thread_revive(p_local, p_thread, p_caller, p_pool)          \ 
  186         if (ABTI_ENABLE_EVENT_INTERFACE) {                                     \ 
  187             ABTI_event_thread_revive_impl(p_local, p_thread, p_caller,         \ 
  192 #define ABTI_event_thread_run(p_local_xstream, p_thread, p_prev, p_parent)     \ 
  194         if (ABTI_ENABLE_EVENT_INTERFACE) {                                     \ 
  195             ABTI_event_thread_run_impl(p_local_xstream, p_thread, p_prev,      \ 
  200 #define ABTI_event_thread_finish(p_local_xstream, p_thread, p_parent)          \ 
  202         if (ABTI_ENABLE_EVENT_INTERFACE) {                                     \ 
  203             ABTI_event_thread_finish_impl(p_local_xstream, p_thread,           \ 
  208 #define ABTI_event_thread_cancel(p_local_xstream, p_thread)                    \ 
  210         if (ABTI_ENABLE_EVENT_INTERFACE) {                                     \ 
  211             ABTI_event_thread_cancel_impl(p_local_xstream, p_thread);          \ 
  215 #define ABTI_event_ythread_yield(p_local_xstream, p_ythread, p_parent,         \ 
  216                                  sync_event_type, p_sync)                      \ 
  218         if (ABTI_ENABLE_EVENT_INTERFACE) {                                     \ 
  219             ABTI_event_ythread_yield_impl(p_local_xstream, p_ythread,          \ 
  220                                           p_parent, sync_event_type, p_sync);  \ 
  224 #define ABTI_event_ythread_suspend(p_local_xstream, p_ythread, p_parent,       \ 
  225                                    sync_event_type, p_sync)                    \ 
  227         if (ABTI_ENABLE_EVENT_INTERFACE) {                                     \ 
  228             ABTI_event_ythread_suspend_impl(p_local_xstream, p_ythread,        \ 
  229                                             p_parent, sync_event_type,         \ 
  234 #define ABTI_event_ythread_resume(p_local, p_ythread, p_caller)                \ 
  236         if (ABTI_ENABLE_EVENT_INTERFACE) {                                     \ 
  237             ABTI_event_ythread_resume_impl(p_local, p_ythread, p_caller);      \