#include <condition.h>
Collaboration diagram for WaitCondition:
Public Member Functions | |
WaitCondition () | |
Set up a condition,. | |
~WaitCondition () | |
Destroy a condition. | |
void | signal () |
If threads are waiting, exactly one of them is woken up. | |
void | broadcast () |
If threads are waiting, all of them are woken up. | |
void | wait (ConditionMutex &m) |
Wait until this thread is woken up on the condition. | |
int | wait (ConditionMutex &m, long msec) |
Like wait but with additional timeout. | |
Private Attributes | |
GCond * | c |
A condition variable must always be associated with a mutex, to avoid the race condition where a thread prepares to wait on a condition variable and another thread signals the condition just before the first thread actually waits on it.
Definition at line 57 of file condition.h.
|
Set up a condition,.
Definition at line 72 of file condition.cc. References c. |
|
Destroy a condition.
Definition at line 85 of file condition.cc. References c. |
|
If threads are waiting, all of them are woken up. Restarts all the threads that are waiting on the condition variable Nothing happens if no threads are waiting.
Definition at line 98 of file condition.h. References c, and USE_PRIVATE__PTHREADS. Referenced by Semaphore::post(). |
|
If threads are waiting, exactly one of them is woken up. Restarts one of the threads that are waiting on the condition If no threads are waiting on it, nothing happens. If several threads are waiting on the condition, exactly one is restarted, but it is not specified which one.
Definition at line 83 of file condition.h. References c, and USE_PRIVATE__PTHREADS. |
|
Like wait but with additional timeout. Limit the waiting time to the passed number of milliseconds.
Definition at line 37 of file condition.cc. References c, and ConditionMutex::m. |
|
Wait until this thread is woken up on the condition. The mutex is unlocked before falling asleep and locked again before resuming, so always enter with a locked mutex.
Definition at line 126 of file condition.h. References c, and USE_PRIVATE__PTHREADS. Referenced by Semaphore::wait(). |
|
Definition at line 63 of file condition.h. Referenced by broadcast(), signal(), wait(), WaitCondition(), and ~WaitCondition(). |