#include <userver/engine/condition_variable.hpp>
std::condition_variable replacement for asynchronous tasks
Definition at line 27 of file condition_variable.hpp.
Public Member Functions | |
ConditionVariable (const ConditionVariable &)=delete | |
ConditionVariable (ConditionVariable &&)=delete | |
ConditionVariable & | operator= (const ConditionVariable &)=delete |
ConditionVariable & | operator= (ConditionVariable &&)=delete |
CvStatus | Wait (std::unique_lock< Mutex > &lock) |
template<typename Predicate > | |
bool | Wait (std::unique_lock< Mutex > &lock, Predicate &&predicate) |
Suspends execution until the predicate is true when notification is received or the task is cancelled. | |
template<typename Rep , typename Period > | |
CvStatus | WaitFor (std::unique_lock< Mutex > &lock, std::chrono::duration< Rep, Period > timeout) |
Suspends execution until notified or until the timeout expires or until the task is cancelled. | |
template<typename Rep , typename Period , typename Predicate > | |
bool | WaitFor (std::unique_lock< Mutex > &lock, std::chrono::duration< Rep, Period > timeout, Predicate &&predicate) |
Suspends execution until the predicate is true when notified or the timeout expires or the task is cancelled. | |
template<typename Clock , typename Duration > | |
CvStatus | WaitUntil (std::unique_lock< Mutex > &lock, std::chrono::time_point< Clock, Duration > until) |
Suspends execution until notified or the time point is reached or the task is cancelled. | |
CvStatus | WaitUntil (std::unique_lock< Mutex > &lock, Deadline deadline) |
Suspends execution until notified or the deadline is reached or the task is cancelled. | |
template<typename Clock , typename Duration , typename Predicate > | |
bool | WaitUntil (std::unique_lock< Mutex > &lock, std::chrono::time_point< Clock, Duration > until, Predicate &&predicate) |
Suspends execution until the predicate is true when notified or the time point is reached or the task is cancelled. | |
template<typename Predicate > | |
bool | WaitUntil (std::unique_lock< Mutex > &lock, Deadline deadline, Predicate &&predicate) |
Suspends execution until the predicate is true when notified or the deadline is reached or the task is cancelled. | |
void | NotifyOne () |
Notifies one of the waiting tasks. | |
void | NotifyAll () |
Notifies all waiting tasks. | |
Suspends execution until notified or cancelled
CvStatus::kNoTimeout
if variable was notified CvStatus::kCancelled
if current task is being cancelled bool engine::ConditionVariable::Wait | ( | std::unique_lock< Mutex > & | lock, |
Predicate && | predicate ) |
Suspends execution until the predicate is true
when notification is received or the task is cancelled.
Definition at line 101 of file condition_variable.hpp.
CvStatus engine::ConditionVariable::WaitFor | ( | std::unique_lock< Mutex > & | lock, |
std::chrono::duration< Rep, Period > | timeout ) |
Suspends execution until notified or until the timeout expires or until the task is cancelled.
CvStatus::kNoTimeout
if variable was notified CvStatus::kTimeout
if timeout
has expired CvStatus::kCancelled
if current task is being cancelled Definition at line 106 of file condition_variable.hpp.
bool engine::ConditionVariable::WaitFor | ( | std::unique_lock< Mutex > & | lock, |
std::chrono::duration< Rep, Period > | timeout, | ||
Predicate && | predicate ) |
Suspends execution until the predicate is true
when notified or the timeout expires or the task is cancelled.
Definition at line 111 of file condition_variable.hpp.
CvStatus engine::ConditionVariable::WaitUntil | ( | std::unique_lock< Mutex > & | lock, |
Deadline | deadline ) |
Suspends execution until notified or the deadline is reached or the task is cancelled.
CvStatus::kNoTimeout
if variable was notified CvStatus::kTimeout
if deadline was reached CvStatus::kCancelled
if current task is being cancelled bool engine::ConditionVariable::WaitUntil | ( | std::unique_lock< Mutex > & | lock, |
Deadline | deadline, | ||
Predicate && | predicate ) |
Suspends execution until the predicate is true
when notified or the deadline is reached or the task is cancelled.
Definition at line 134 of file condition_variable.hpp.
CvStatus engine::ConditionVariable::WaitUntil | ( | std::unique_lock< Mutex > & | lock, |
std::chrono::time_point< Clock, Duration > | until ) |
Suspends execution until notified or the time point is reached or the task is cancelled.
CvStatus::kNoTimeout
if variable was notified CvStatus::kTimeout
if until
time point was reached CvStatus::kCancelled
if current task is being cancelled Definition at line 120 of file condition_variable.hpp.
bool engine::ConditionVariable::WaitUntil | ( | std::unique_lock< Mutex > & | lock, |
std::chrono::time_point< Clock, Duration > | until, | ||
Predicate && | predicate ) |
Suspends execution until the predicate is true
when notified or the time point is reached or the task is cancelled.
Definition at line 125 of file condition_variable.hpp.