Class for thread condition variables
![]() | broadcastSignal () Signal that a condition has arisen |
![]() | getNexusCondition () Return nexus' condition variable. |
![]() | signal () Signal that a condition has arisen |
![]() | wait (CAVERNplus_mutex_c *mutex) Wait on a condition to be signalled |
Class for thread condition variables. Condition variables are used in conjunction with mutexes to provide a way for threads to wait until a condition occurs.An example of waiting on a signal is:
// Lock your mutex that is protecting someState. myMutex->lock(); // Watch for your desired state to occur. while(someState != reached) { // Wait for a signal. myCondition->wait(myMutex); .... got the condition and the lock so now continue .... } myMutex->unlock();An example of sending the signal is:
// Lock your mutex that is protecting someState. myMutex->lock(); // Signal that the state has been reached. if (someState == reached) myCondition->signal(); // Unlock your mutex so that the waiting thread can continue. myMutex->unlock();
int signal()
int broadcastSignal()
this page has been generated automatically by doc++
(c)opyright by Malte Zöckler, Roland Wunderling
contact: doc++@zib.de