libcoro  1.0
Coroutine support library for C++20

◆ notify_condition() [2/2]

template<typename T , std::invocable< prepared_coro > Fn>
void coro::notify_condition ( const T &  var,
Fn &&  scheduler 
)
noexcept

notifies variable about change in the condition.

Parameters
varreference to shared variable.
schedulerfunction which receives prepared_coro, and which is responsible to schedule resumption of the coroutine. Default implementation simply resumes the coroutine, but you can define own behaviour

Tests all conditions and resumes all coroutines, where condition is fulfilled.

It is not UB when variable is already destroyed. You can pass anything. If the variable is not awaited, nothing happens.

See also
condition

Definition at line 313 of file condition.h.