|
|
Defined in header <condition_variable> | ||
class condition_variable_any; | (since C++11) | |
Thecondition_variable_any
class is a generalization ofstd::condition_variable. Whereasstd::condition_variable works only onstd::unique_lock<std::mutex>,condition_variable_any
can operate on any lock that meets theBasicLockable requirements.
Seestd::condition_variable for the description of the semantics of condition variables.
The classstd::condition_variable_any
is aStandardLayoutType. It is notCopyConstructible,MoveConstructible,CopyAssignable, orMoveAssignable.
If the lock isstd::unique_lock<std::mutex>,std::condition_variable may provide better performance.
Contents |
constructs the object (public member function)[edit] | |
destructs the object (public member function)[edit] | |
operator= [deleted] | not copy-assignable (public member function)[edit] |
Notification | |
notifies one waiting thread (public member function)[edit] | |
notifies all waiting threads (public member function)[edit] | |
Waiting | |
blocks the current thread until the condition variable is awakened (public member function)[edit] | |
blocks the current thread until the condition variable is awakened or after the specified timeout duration (public member function)[edit] | |
blocks the current thread until the condition variable is awakened or until specified time point has been reached (public member function)[edit] |
std::condition_variable_any
can be used withstd::shared_lock in order to wait on astd::shared_mutex in shared ownership mode.
A possible use forstd::condition_variable_any
with customLockable types is to provide convenient interruptible waits: the custom lock operation would both lock the associated mutex as expected, and also perform the necessary setup to notify this condition variable when the interrupting signal is received.[1]
(C++11) | provides a condition variable associated with astd::unique_lock (class)[edit] |
|