Miosix
2.0alpha1
|
#include <sync.h>
Public Member Functions | |
ConditionVariable () | |
template<typename T > | |
void | wait (Lock< T > &l) |
void | wait (Mutex &m) |
void | wait (FastMutex &m) |
void | signal () |
void | broadcast () |
A condition variable class for thread synchronization, available from Miosix 1.53.
One or more threads can wait on the condition variable, and the signal() and broadcast() allow to wake ne or all the waiting threads.
This class is meant to be a static or global class. Dynamically creating a ConditionVariable with new or on the stack must be done with care, to avoid deleting a ConditionVariable while some threads are waiting, and to avoid situations where a thread tries to wait on a deleted ConditionVariable.
miosix::ConditionVariable::ConditionVariable | ( | ) |
Constructor, initializes the ConditionVariable.
void miosix::ConditionVariable::broadcast | ( | ) |
Wakeup all waiting threads.
void miosix::ConditionVariable::signal | ( | ) |
Wakeup one waiting thread. Currently implemented policy is fifo.
|
inline |
void miosix::ConditionVariable::wait | ( | Mutex & | m | ) |
void miosix::ConditionVariable::wait | ( | FastMutex & | m | ) |