New wait Overloads for the condition_variable_any
Explore three different wait variations of 'std::condition_variable_any'.
We'll cover the following...
The three wait variations to wait
, wait_for
, and wait_until
of the std::condition_variable_any
get new overloads. They take a std::stop_token
.
Press + to interact
template <class Predicate>bool wait(Lock& lock,stop_token stoken,Predicate pred);template <class Rep, class Period, class Predicate>bool wait_for(Lock& lock,stop_token stoken,const chrono::duration<Rep, Period>& rel_time,Predicate pred);template <class Clock, class Duration, class Predicate>bool wait_until(Lock& lock,stop_token stoken,const chrono::time_point<Clock, Duration>& abs_time,Predicate pred);
These new overloads need a predicate. The presented versions ensure that the threads be notified if a stop request for ...