23 #include "orte_config.h"
29 #include "opal/util/fd.h"
30 #include "opal/mca/event/event.h"
33 #include "condition.h"
42 volatile bool running;
50 #define ORTE_ACQUIRE_THREAD(ctl) \
52 ORTE_THREAD_LOCK(&(ctl)->lock); \
53 if (opal_debug_threads) { \
54 opal_output(0, "Waiting for thread %s at %s:%d:%s", \
55 (NULL == (ctl)->name) ? "NULL" : (ctl)->name, \
57 ((ctl)->active) ? "TRUE" : "FALSE"); \
59 while ((ctl)->active) { \
60 ORTE_CONDITION_WAIT(&(ctl)->cond, &(ctl)->lock); \
62 if (opal_debug_threads) { \
63 opal_output(0, "Thread %s acquired at %s:%d", \
64 (NULL == (ctl)->name) ? "NULL" : (ctl)->name, \
65 __FILE__, __LINE__); \
67 (ctl)->active = true; \
70 #define ORTE_ACQUIRE_THREAD(ctl) \
72 ORTE_THREAD_LOCK(&(ctl)->lock); \
73 while ((ctl)->active) { \
74 ORTE_CONDITION_WAIT(&(ctl)->cond, &(ctl)->lock); \
76 (ctl)->active = true; \
82 #define ORTE_RELEASE_THREAD(ctl) \
84 if (opal_debug_threads) { \
85 opal_output(0, "Releasing thread %s at %s:%d", \
86 (NULL == (ctl)->name) ? "NULL" : (ctl)->name, \
87 __FILE__, __LINE__); \
89 (ctl)->active = false; \
90 ORTE_CONDITION_BROADCAST(&(ctl)->cond); \
91 OPAL_UPDATE_EVBASE((ctl)->evbase, NULL, OPAL_EVENT_NOOP); \
92 ORTE_THREAD_UNLOCK(&(ctl)->lock); \
95 #define ORTE_RELEASE_THREAD(ctl) \
97 (ctl)->active = false; \
98 ORTE_CONDITION_BROADCAST(&(ctl)->cond); \
99 OPAL_UPDATE_EVBASE((ctl)->evbase, NULL, OPAL_EVENT_NOOP); \
100 ORTE_THREAD_UNLOCK(&(ctl)->lock); \
104 #if OPAL_ENABLE_DEBUG
105 #define ORTE_WAKEUP_THREAD(ctl) \
107 ORTE_THREAD_LOCK(&(ctl)->lock); \
108 if (opal_debug_threads) { \
109 opal_output(0, "Waking up thread %s at %s:%d", \
110 (NULL == (ctl)->name) ? "NULL" : (ctl)->name, \
111 __FILE__, __LINE__); \
113 (ctl)->active = false; \
114 ORTE_CONDITION_BROADCAST(&(ctl)->cond); \
115 OPAL_UPDATE_EVBASE((ctl)->evbase, NULL, OPAL_EVENT_NOOP); \
116 ORTE_THREAD_UNLOCK(&(ctl)->lock); \
119 #define ORTE_WAKEUP_THREAD(ctl) \
121 ORTE_THREAD_LOCK(&(ctl)->lock); \
122 (ctl)->active = false; \
123 ORTE_CONDITION_BROADCAST(&(ctl)->cond); \
124 OPAL_UPDATE_EVBASE((ctl)->evbase, NULL, OPAL_EVENT_NOOP); \
125 ORTE_THREAD_UNLOCK(&(ctl)->lock); \
OPAL output stream facility.
Definition: condition.h:49
Definition: mutex_unix.h:53
Definition: libevent2013.h:73
Base object.
Definition: opal_object.h:182
A simple C-language object-oriented system with single inheritance and ownership-based memory managem...
#define OBJ_CLASS_DECLARATION(NAME)
Declaration for class descriptor.
Definition: opal_object.h:236