32 Thread support library [thread]

32.6 Condition variables [thread.condition]

32.6.1 General [thread.condition.general]

Condition variables provide synchronization primitives used to block a thread until notified by some other thread that some condition is met or until a system time is reached.
Class condition_­variable provides a condition variable that can only wait on an object of type unique_­lock<mutex>, allowing the implementation to be more efficient.
Class condition_­variable_­any provides a general condition variable that can wait on objects of user-supplied lock types.
Condition variables permit concurrent invocation of the wait, wait_­for, wait_­until, notify_­one and notify_­all member functions.
The executions of notify_­one and notify_­all are atomic.
The executions of wait, wait_­for, and wait_­until are performed in three atomic parts:
1.the release of the mutex and entry into the waiting state;
2.the unblocking of the wait; and
3.the reacquisition of the lock.
The implementation behaves as if all executions of notify_­one, notify_­all, and each part of the wait, wait_­for, and wait_­until executions are executed in a single unspecified total order consistent with the "happens before" order.
Condition variable construction and destruction need not be synchronized.