This class just encapsulates a condition variable (from the pthread library), with default attributes. More...
#include <DwmConditionVariable.hh>
Public Member Functions | |
| ConditionVariable () | |
| Constructor, initializes the condition variable. | |
| ~ConditionVariable () | |
| Destructor, destroys the condition variable. | |
| bool | Broadcast () |
| Unblocks all threads waiting for the condition variable. More... | |
| bool | Signal () |
| Unblocks one thread waiting for the condition variable. More... | |
| bool | TimedWait (Mutex &mutex, const struct timespec *abstime) |
Atomically blocks the calling thread waiting on the condition variable, and unblocks the mutex specified by mutex. More... | |
| bool | Wait (Mutex &mutex) |
Atomically blocks the current thread waiting on the condition variable, and unblocks the mutex specified by mutex. More... | |
Protected Attributes | |
| pthread_cond_t | _cv |
This class just encapsulates a condition variable (from the pthread library), with default attributes.
| bool Dwm::Pthread::ConditionVariable::Broadcast | ( | ) |
Unblocks all threads waiting for the condition variable.
Returns true on success.
| bool Dwm::Pthread::ConditionVariable::Signal | ( | ) |
Unblocks one thread waiting for the condition variable.
Returns true on success.
| bool Dwm::Pthread::ConditionVariable::TimedWait | ( | Mutex & | mutex, |
| const struct timespec * | abstime | ||
| ) |
Atomically blocks the calling thread waiting on the condition variable, and unblocks the mutex specified by mutex.
The waiting thread unblocks only after another thread calls Signal(), or Broadcast() on the same object, or if the system time reaches the time specified in abstime, and the current thread reacquires the lock on mutex.
| bool Dwm::Pthread::ConditionVariable::Wait | ( | Mutex & | mutex | ) |
Atomically blocks the current thread waiting on the condition variable, and unblocks the mutex specified by mutex.
The waiting thread unblocks only after another thread calls Signal() or Broadcast() on the same object, and the current thread reacquires the lock on mutex.