00001 #ifndef COIN_SBCONDVAR_H
00002 #define COIN_SBCONDVAR_H
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include <Inventor/SbBasic.h>
00028 #include <Inventor/SbTime.h>
00029 #include <Inventor/C/threads/condvar.h>
00030 #include <Inventor/threads/SbMutex.h>
00031
00032 class SbCondVar {
00033 public:
00034 SbCondVar(void) { this->condvar = cc_condvar_construct(); }
00035 ~SbCondVar(void) { cc_condvar_destruct(this->condvar); }
00036
00037 SbBool wait(SbMutex & mutex) {
00038 return cc_condvar_wait(this->condvar, mutex.mutex) == CC_OK;
00039 }
00040 SbBool timedWait(SbMutex & mutex, SbTime period) {
00041 return cc_condvar_timed_wait(this->condvar, mutex.mutex, period.getValue()) == CC_OK;
00042 }
00043
00044 void wakeOne(void) { cc_condvar_wake_one(this->condvar); }
00045 void wakeAll(void) { cc_condvar_wake_all(this->condvar); }
00046
00047 private:
00048 cc_condvar * condvar;
00049 };
00050
00051 #endif // !COIN_SBCONDVAR_H