Lunchbox
1.8.0
|
A condition variable and associated lock. More...
#include <condition.h>
Public Member Functions | |
Condition () | |
Construct a new condition variable. | |
~Condition () | |
Destruct this condition variable. | |
void | lock () |
Lock the mutex. | |
void | unlock () |
Unlock the mutex. | |
void | signal () |
Signal the condition. | |
void | broadcast () |
Broadcast the condition. | |
void | wait () |
Atomically unlock the mutex, wait for a signal and relock the mutex. | |
bool | timedWait (const uint32_t 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 33 of file condition.h.
lunchbox::Condition::Condition | ( | ) |
Construct a new condition variable.
lunchbox::Condition::~Condition | ( | ) |
Destruct this condition variable.
void lunchbox::Condition::broadcast | ( | ) |
Broadcast the condition.
Referenced by lunchbox::Monitor< T >::operator&=(), lunchbox::Monitor< T >::operator++(), lunchbox::Monitor< T >::operator--(), lunchbox::Monitor< T >::operator|=(), and lunchbox::Monitor< T >::set().
void lunchbox::Condition::lock | ( | ) |
Lock the mutex.
Referenced by lunchbox::MTQueue< T, S >::operator=().
void lunchbox::Condition::signal | ( | ) |
Signal the condition.
bool lunchbox::Condition::timedWait | ( | const uint32_t | 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. |
Referenced by lunchbox::Monitor< T >::timedWaitEQ(), lunchbox::Monitor< T >::timedWaitGE(), and lunchbox::Monitor< T >::timedWaitNE().
void lunchbox::Condition::unlock | ( | ) |
Unlock the mutex.
Referenced by lunchbox::MTQueue< T, S >::operator=().
void lunchbox::Condition::wait | ( | ) |
Atomically unlock the mutex, wait for a signal and relock the mutex.
Referenced by lunchbox::Monitor< T >::waitEQ(), lunchbox::Monitor< T >::waitGE(), lunchbox::Monitor< T >::waitLE(), and lunchbox::Monitor< T >::waitNE().