Lunchbox
1.11.0
|
A condition variable and associated lock. More...
#include <condition.h>
Public Member Functions | |
LUNCHBOX_API | Condition () |
Construct a new condition variable. More... | |
LUNCHBOX_API | ~Condition () |
Destruct this condition variable. More... | |
LUNCHBOX_API void | lock () |
Lock the mutex. More... | |
LUNCHBOX_API void | unlock () |
Unlock the mutex. More... | |
LUNCHBOX_API void | signal () |
Signal the condition. More... | |
LUNCHBOX_API void | broadcast () |
Broadcast the condition. More... | |
LUNCHBOX_API void | wait () |
Atomically unlock the mutex, wait for a signal and relock the mutex. More... | |
LUNCHBOX_API bool | timedWait (const uint32_t timeout) |
Atomically unlock the mutex, wait for a signal and relock the mutex. More... | |
A condition variable and associated lock.
Semantics follow closely pthread_condition and mutex.
Definition at line 33 of file condition.h.
LUNCHBOX_API lunchbox::Condition::Condition | ( | ) |
Construct a new condition variable.
LUNCHBOX_API lunchbox::Condition::~Condition | ( | ) |
Destruct this condition variable.
LUNCHBOX_API 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().
LUNCHBOX_API void lunchbox::Condition::lock | ( | ) |
Lock the mutex.
Referenced by lunchbox::MTQueue< T, S >::operator=().
LUNCHBOX_API void lunchbox::Condition::signal | ( | ) |
Signal the condition.
LUNCHBOX_API 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. |
LUNCHBOX_API void lunchbox::Condition::unlock | ( | ) |
Unlock the mutex.
Referenced by lunchbox::MTQueue< T, S >::operator=().
LUNCHBOX_API void lunchbox::Condition::wait | ( | ) |
Atomically unlock the mutex, wait for a signal and relock the mutex.
Referenced by lunchbox::Monitor< T >::waitNE().