38 res = pthread_cond_init( &mCondition, 0 );
40 CLAM_ASSERT( res == 0,
"pthread_cond_init call failed" );
47 res = pthread_cond_destroy( &mCondition );
49 CLAM_ASSERT( res==0,
"pthread_cond_destroy call failed" );
56 res = pthread_cond_broadcast( &mCondition );
58 CLAM_ASSERT( res==0,
"pthread_cond_broadcast call failed!" );
65 res = pthread_cond_signal( &mCondition );
67 CLAM_ASSERT( res == 0,
"pthread_cond_signal call failed" );
70 void Condition::DoWait( pthread_mutex_t* pmutex )
74 res = pthread_cond_wait( &mCondition, pmutex );
76 CLAM_ASSERT( res == 0,
"pthread_cond_wait call failed" );
79 bool Condition::DoTimedWait(
const xtime& xt, pthread_mutex_t* pmutex )
87 res = pthread_cond_timedwait( &mCondition, pmutex, &ts );
89 std::ostringstream os;
90 os <<
"Something strange has happened. PThread returned from timed wait with result code " << res << std::flush;
91 CLAM_ASSERT( res == 0 || res == ETIMEDOUT , os.str().c_str() );
93 return res != ETIMEDOUT;