Equalizer 1.0
|
A condition variable and associated lock. More...
#include <condition.h>
Public Member Functions | |
COBASE_API | Condition () |
Construct a new condition variable. | |
COBASE_API | ~Condition () |
Destruct this condition variable. | |
COBASE_API void | lock () |
Lock the mutex. | |
COBASE_API void | unlock () |
Unlock the mutex. | |
COBASE_API void | signal () |
Signal the condition. | |
COBASE_API void | broadcast () |
Broadcast the condition. | |
COBASE_API void | wait () |
Atomically unlock the mutex, wait for a signal and relock the mutex. | |
bool | timedWait (const unsigned timeout) |
Atomically unlock the mutex, wait for a signal and relock the mutex. |
A condition variable and associated lock.
Follows closely pthread_condition and mutex
Definition at line 34 of file condition.h.
COBASE_API co::base::Condition::Condition | ( | ) |
Construct a new condition variable.
COBASE_API co::base::Condition::~Condition | ( | ) |
Destruct this condition variable.
COBASE_API void co::base::Condition::broadcast | ( | ) |
Broadcast the condition.
Referenced by co::base::Monitor< State >::operator++(), co::base::Monitor< State >::operator--(), co::base::Monitor< State >::operator|=(), and co::base::Monitor< State >::set().
COBASE_API void co::base::Condition::lock | ( | ) |
Lock the mutex.
Referenced by co::base::MTQueue< Command * >::clear(), co::base::MTQueue< Command * >::getBack(), co::base::MTQueue< Command * >::getFront(), co::base::Monitor< State >::operator++(), co::base::Monitor< State >::operator--(), co::base::MTQueue< Command * >::operator=(), co::base::Monitor< State >::operator|=(), co::base::MTQueue< Command * >::pop(), co::base::MTQueue< Command * >::push(), co::base::MTQueue< Command * >::pushFront(), co::base::Monitor< State >::set(), co::base::MTQueue< Command * >::tryPop(), co::base::Monitor< State >::waitEQ(), co::base::Monitor< State >::waitGE(), co::base::Monitor< State >::waitLE(), co::base::Monitor< State >::waitNE(), and co::base::MTQueue< Command * >::waitSize().
COBASE_API void co::base::Condition::signal | ( | ) |
Signal the condition.
Referenced by co::base::MTQueue< Command * >::operator=(), co::base::MTQueue< Command * >::push(), and co::base::MTQueue< Command * >::pushFront().
bool co::base::Condition::timedWait | ( | const unsigned | timeout | ) |
Atomically unlock the mutex, wait for a signal and relock the mutex.
The operation is aborted after the given timeout and false is returned.
timeout | the timeout in milliseconds to wait for the signal. |
COBASE_API void co::base::Condition::unlock | ( | ) |
Unlock the mutex.
Referenced by co::base::MTQueue< Command * >::clear(), co::base::MTQueue< Command * >::getBack(), co::base::MTQueue< Command * >::getFront(), co::base::Monitor< State >::operator++(), co::base::Monitor< State >::operator--(), co::base::MTQueue< Command * >::operator=(), co::base::Monitor< State >::operator|=(), co::base::MTQueue< Command * >::pop(), co::base::MTQueue< Command * >::push(), co::base::MTQueue< Command * >::pushFront(), co::base::Monitor< State >::set(), co::base::MTQueue< Command * >::tryPop(), co::base::Monitor< State >::waitEQ(), co::base::Monitor< State >::waitGE(), co::base::Monitor< State >::waitLE(), co::base::Monitor< State >::waitNE(), and co::base::MTQueue< Command * >::waitSize().
COBASE_API void co::base::Condition::wait | ( | ) |
Atomically unlock the mutex, wait for a signal and relock the mutex.
Referenced by co::base::MTQueue< Command * >::pop(), co::base::Monitor< State >::waitEQ(), co::base::Monitor< State >::waitGE(), co::base::Monitor< State >::waitLE(), co::base::Monitor< State >::waitNE(), and co::base::MTQueue< Command * >::waitSize().