00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 INLINE ConditionVarPosixImpl::
00022 ConditionVarPosixImpl(MutexPosixImpl &mutex) :
00023 _mutex(mutex)
00024 {
00025 TAU_PROFILE("ConditionVarPosixImpl::ConditionVarPosixImpl()", " ", TAU_USER);
00026 int result = pthread_cond_init(&_cvar, NULL);
00027 nassertv(result == 0);
00028 }
00029
00030
00031
00032
00033
00034
00035 INLINE ConditionVarPosixImpl::
00036 ~ConditionVarPosixImpl() {
00037 TAU_PROFILE("ConditionVarPosixImpl::~ConditionVarPosixImpl()", " ", TAU_USER);
00038 int result = pthread_cond_destroy(&_cvar);
00039 nassertv(result == 0);
00040 }
00041
00042
00043
00044
00045
00046
00047 INLINE void ConditionVarPosixImpl::
00048 wait() {
00049 TAU_PROFILE("ConditionVarPosixImpl::wait()", " ", TAU_USER);
00050 int result = pthread_cond_wait(&_cvar, &_mutex._lock);
00051 #ifndef NDEBUG
00052 if (result != 0) {
00053 pipeline_cat.error()
00054 << "Unexpected error " << result << " from pthread_cond_wait()\n";
00055 }
00056 #endif
00057 }
00058
00059
00060
00061
00062
00063
00064 INLINE void ConditionVarPosixImpl::
00065 notify() {
00066 TAU_PROFILE("ConditionVarPosixImpl::notify()", " ", TAU_USER);
00067 int result = pthread_cond_signal(&_cvar);
00068 nassertv(result == 0);
00069 }
00070
00071
00072
00073
00074
00075
00076 INLINE void ConditionVarPosixImpl::
00077 notify_all() {
00078 TAU_PROFILE("ConditionVarPosixImpl::notify()", " ", TAU_USER);
00079 int result = pthread_cond_broadcast(&_cvar);
00080 nassertv(result == 0);
00081 }