std::condition_variable
From Cppreference
| Defined in header <condition_variable>
|
||
| class condition_variable;
|
(since C++11) | |
The condition_variable class manages a list of threads that are waiting until another thread notifies one or all of the waiting threads that they may proceed, until a timeout expires, or until a spurious wakeup occurs. Any thread that intends to wait on std::condition_variable has to acquire a std::unique_lock first. The wait operation atomically releases the mutex and suspends the execution of the thread. When the thread is awakened, the mutex is reacquired.
The class std::condition_variable is a standard-layout class. It is not copy-constructible, move-constructible, copy-assignable, or move-assignable.
Contents |
[edit] Member types
| Member type | Definition |
| native_handle_type | implementation-defined |
[edit] Member functions
| constructs the object (public member function) |
|
| destructs the object (public member function) |
|
| operator=
[deleted]
|
not copy-assignable (public member function) |
Notification | |
| notifies one waiting thread (public member function) |
|
| notifies all waiting threads (public member function) |
|
Waiting | |
| blocks the current thread until the condition variable is woken up (public member function) |
|
| blocks the current thread until the condition variable is woken up or after the specified timeout duration (public member function) |
|
| blocks the current thread until the condition variable is woken up or until specified time point has been reached (public member function) |
|
Native handle | |
| returns the native handle (public member function) |
|