A condition variable, usually used to communicate information about changing state to a thread that is waiting for something to happen. More...
#include "conditionVar.h"
Public Member Functions | |
ConditionVar (Mutex &mutex) | |
You must pass in a Mutex to the condition variable constructor. More... | |
ConditionVar (const ConditionVar ©)=delete | |
Mutex & | get_mutex () const |
Returns the mutex associated with this condition variable. More... | |
void | notify_all ()=delete |
ConditionVar & | operator= (const ConditionVar ©)=delete |
![]() | |
ConditionVarDirect (MutexDirect &mutex) | |
You must pass in a Mutex to the condition variable constructor. More... | |
ConditionVarDirect (const ConditionVarDirect ©)=delete | |
MutexDirect & | get_mutex () const |
Returns the mutex associated with this condition variable. More... | |
void | notify () |
Informs one of the other threads who are currently blocked on wait() that the relevant condition has changed. More... | |
ConditionVarDirect & | operator= (const ConditionVarDirect ©)=delete |
void | output (std::ostream &out) const |
This method is declared virtual in ConditionVarDebug, but non-virtual in ConditionVarDirect. More... | |
void | wait () |
Waits on the condition. More... | |
void | wait (double timeout) |
Waits on the condition, with a timeout. More... | |
A condition variable, usually used to communicate information about changing state to a thread that is waiting for something to happen.
A condition variable can be used to "wake up" a thread when some arbitrary condition has changed.
The ConditionVar class does not support the full semantics of POSIX condition variables. In particular, it does not support the broadcast or notify_all function. See ConditionVarFull for a more complete (but possibly more expensive) API.
A condition variable is associated with a single mutex, and several condition variables may share the same mutex.
This class inherits its implementation either from ConditionVarDebug or ConditionVarDirect, depending on the definition of DEBUG_THREADS.
Definition at line 41 of file conditionVar.h.
|
inlineexplicit |
You must pass in a Mutex to the condition variable constructor.
This mutex may be shared by other condition variables, if desired. It is the caller's responsibility to ensure the Mutex object does not destruct during the lifetime of the condition variable.
Definition at line 21 of file conditionVar.I.
|
inline |
Returns the mutex associated with this condition variable.
Definition at line 34 of file conditionVar.I.
References ConditionVarDirect::get_mutex().