std::condition_variable_any (3) - Linux Manuals
std::condition_variable_any - std::condition_variable_any
Defined in header <condition_variable>
class condition_variable_any; (since C++11)
The condition_variable_any class is a generalization of std::condition_variable. Whereas std::condition_variable works only on std::unique_lock<std::mutex>, condition_variable_any can operate on any lock that meets the BasicLockable requirements.
See std::condition_variable for the description of the semantics of condition variables.
The class std::condition_variable_any is a StandardLayoutType. It is not CopyConstructible, MoveConstructible, CopyAssignable, or MoveAssignable.
If the lock is std::unique_lock, std::condition_variable may provide better performance.
constructor (public member function)
destructor (public member function)
operator= not copy-assignable
notify_one (public member function)
notify_all (public member function)
wait (public member function)
wait_for (public member function)
wait_until (public member function)
std::condition_variable_any can be used with std::shared_lock in order to wait on a std::shared_mutex in shared ownership mode.
A possible use for std::condition_variable_any with custom Lockable 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.