|
MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
|
Suspends a FreeRoutine until a caller-supplied predicate returns true. More...
#include <ConditionAwaiter.hpp>
Collaboration diagram for MayaFlux::Kriya::ConditionAwaiter:Public Member Functions | |
| bool | await_ready () const |
| Evaluate the condition before suspending. | |
| void | await_resume () const |
| No value to return on resumption. | |
| void | await_suspend (std::coroutine_handle< Vruta::conditional_promise > handle) |
| Arm the promise with the condition and the coroutine handle. | |
| ConditionAwaiter (std::function< bool()> condition) | |
| Construct with a condition predicate. | |
Private Attributes | |
| std::function< bool()> | m_condition |
Suspends a FreeRoutine until a caller-supplied predicate returns true.
await_ready() evaluates the condition immediately; if already true the coroutine does not suspend. Otherwise await_suspend() arms the promise so the scheduler's CONDITIONAL thread will evaluate the condition on each pass and resume the handle when it returns true.
The condition is moved into the promise on suspension and cleared on resumption. It must be safe to call from the scheduler thread.
Definition at line 28 of file ConditionAwaiter.hpp.