|ConditionVariable (Mutex &mutex)|
|Create and initialize a ConditionVariable object. More...|
|Wait for a notification. More...|
|bool||wait_until (uint64_t millisec)|
|Wait for a notification until the specified time. More...|
|bool||wait_for (uint32_t millisec)|
|Wait for a notification or timeout. More...|
|Notify one waiter on this condition variable that a condition changed. More...|
|Notify all waiters on this condition variable that a condition changed. More...|
|ConditionVariable destructor. More...|
The ConditionVariable class is a synchronization primitive that allows threads to wait until a particular condition occurs.
Use the condition variable in conjunction with a mutex to safely wait for or notify waiters of condition changes to a resource accessible by multiple threads.
The thread that intends to wait on a ConditionVariable must:
wait_until. While the thread is waiting, the mutex is unlocked.
wait_untilthe timeout expires, the thread is awakened.
The thread that intends to notify a ConditionVariable must:
notify_allon the condition variable.
All threads waiting on the condition variable wake when
ConditionVariable::notify_all is called. At least one thread waiting on the condition variable wakes when
ConditionVariable::notify_one is called.
ConditionVariable::notify_oneis unspecified if there are multiple waiters.
ConditionVariable::notify_allis called and there are one or more waiters, and one or more threads attempting to acquire the condition variable's mutex, the order in which the mutex is acquired is unspecified.
ConditionVariable::notify_allis called is undefined.
ConditionVariable::wait_foris undefined if the condition variable's mutex is locked more than once by the calling thread.