Template:cpp/thread/condition variable/wait

causes the current thread to block until the condition variable is notified or a spurious wakeup occurs, optionally looping until some predicate is satisfied.

@1@ Atomically unlocks, blocks the current executing thread, and adds it to the list of threads waiting on. The thread will be unblocked when notify_all or notify_one is executed. It may also be unblocked spuriously. When unblocked, regardless of the reason, is reacquired and  exits. @2@ Equivalent to

This overload may be used to ignore spurious awakenings while waiting for a specific condition to become true. Note that must be acquired before entering this method, and it is reacquired after  exits, which means that  can be used to guard access to.

If these functions fail to meet the postconditions (, std is called. For example, this could happen if relocking the mutex throws an exception.

Exceptions
@1@ Does not throw @2@ Same as but may also propagate exceptions thrown by