Namespaces
Variants
Views
Actions

std::condition_variable

From cppreference.com
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) [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 woken up
(public member function) [edit]
blocks the current thread until the condition variable
is woken up or after the specified timeout duration
(public member function) [edit]
blocks the current thread until the condition variable
is woken up or until specified time point has been reached
(public member function) [edit]
Native handle
returns the native handle
(public member function) [edit]