Lunchbox
1.4.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 32 of file condition.h.
Construct a new condition variable.
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|=(), and lunchbox::Monitor< T >::set().
void lunchbox::Condition::lock | ( | ) |
Lock the mutex.
Referenced by lunchbox::MTQueue< T, S >::clear(), lunchbox::MTQueue< T, S >::getBack(), lunchbox::MTQueue< T, S >::getFront(), lunchbox::MTQueue< T, S >::operator=(), lunchbox::MTQueue< T, S >::operator[](), lunchbox::MTQueue< T, S >::pop(), lunchbox::MTQueue< T, S >::push(), lunchbox::MTQueue< T, S >::pushFront(), lunchbox::MTQueue< T, S >::setMaxSize(), lunchbox::MTQueue< T, S >::timedPop(), lunchbox::MTQueue< T, S >::tryPop(), and lunchbox::MTQueue< T, S >::waitSize().
void lunchbox::Condition::signal | ( | ) |
Signal the condition.
Referenced by lunchbox::MTQueue< T, S >::clear(), lunchbox::MTQueue< T, S >::operator=(), lunchbox::MTQueue< T, S >::pop(), lunchbox::MTQueue< T, S >::push(), lunchbox::MTQueue< T, S >::pushFront(), lunchbox::MTQueue< T, S >::setMaxSize(), lunchbox::MTQueue< T, S >::timedPop(), and lunchbox::MTQueue< T, S >::tryPop().
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::MTQueue< T, S >::timedPop(), 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 >::clear(), lunchbox::MTQueue< T, S >::getBack(), lunchbox::MTQueue< T, S >::getFront(), lunchbox::MTQueue< T, S >::operator=(), lunchbox::MTQueue< T, S >::operator[](), lunchbox::MTQueue< T, S >::pop(), lunchbox::MTQueue< T, S >::push(), lunchbox::MTQueue< T, S >::pushFront(), lunchbox::MTQueue< T, S >::setMaxSize(), lunchbox::MTQueue< T, S >::timedPop(), lunchbox::MTQueue< T, S >::tryPop(), and lunchbox::MTQueue< T, S >::waitSize().
void lunchbox::Condition::wait | ( | ) |
Atomically unlock the mutex, wait for a signal and relock the mutex.
Referenced by lunchbox::MTQueue< T, S >::operator[](), lunchbox::MTQueue< T, S >::pop(), lunchbox::MTQueue< T, S >::push(), lunchbox::MTQueue< T, S >::pushFront(), lunchbox::MTQueue< T, S >::setMaxSize(), lunchbox::Monitor< T >::waitEQ(), lunchbox::Monitor< T >::waitGE(), lunchbox::Monitor< T >::waitLE(), lunchbox::Monitor< T >::waitNE(), and lunchbox::MTQueue< T, S >::waitSize().