1
1

Add a pair of convenience macros for handling threads to minimize code duplication

This commit was SVN r22861.
Этот коммит содержится в:
Ralph Castain 2010-03-22 15:45:03 +00:00
родитель f01f70b8f6
Коммит df2d361b2b

Просмотреть файл

@ -28,6 +28,8 @@
#endif
#include "opal/class/opal_object.h"
#include "mutex.h"
#include "condition.h"
BEGIN_C_DECLS
@ -58,6 +60,23 @@ typedef struct opal_thread_t opal_thread_t;
OPAL_DECLSPEC OBJ_CLASS_DECLARATION(opal_thread_t);
#define OPAL_ACQUIRE_THREAD(lck, cnd, act) \
do { \
OPAL_THREAD_LOCK((lck)); \
while (*(act)) { \
opal_condition_wait((cnd), (lck)); \
} \
*(act) = true; \
} while(0);
#define OPAL_RELEASE_THREAD(lck, cnd, act) \
do { \
*(act) = false; \
opal_condition_broadcast((cnd)); \
OPAL_THREAD_UNLOCK((lck)); \
} while(0);
OPAL_DECLSPEC int opal_thread_start(opal_thread_t *);
OPAL_DECLSPEC int opal_thread_join(opal_thread_t *, void **thread_return);
OPAL_DECLSPEC bool opal_thread_self_compare(opal_thread_t*);