Conditional variable class. More...
#include <Thread.h>
Public Member Functions | |
Cond () | |
Class constructor. | |
virtual | ~Cond () |
Class destructor. | |
bool | lock () |
Lock the thread mutex Aquire mutex lock for the thread. | |
void | unlock () |
Unlock the thread mutex Release the mutex lock for the thread. | |
void | signal () |
Signal a condition. | |
bool | wait () |
Wait for a condition. | |
bool | wait (int ms) |
Wait for a condition, up to specified milliseconds. |
Conditional variable class.
Wraps a pthread mutex and conditional, use for advanced cases of conditional wait.
Cond::Cond | ( | ) |
Class constructor.
Initializes the condition variable object.
Cond::~Cond | ( | ) | [virtual] |
Class destructor.
Terminates the condition variable object. The mutex is unlocked before termination.
bool Cond::lock | ( | ) |
Lock the thread mutex Aquire mutex lock for the thread.
void Cond::signal | ( | ) |
bool Cond::wait | ( | int | ms | ) |
Wait for a condition, up to specified milliseconds.
Waits for a condition variable being signaled. Mutex must be locked before calling wait(); wait unlocks the mutex atomically while sleeping and re-locks after exiting from sleep; unlock mutex afterwards.
ms | Number of milliseconds to wait |
bool Cond::wait | ( | ) |