boost::capy::delay_awaitable
IoAwaitable returned by delay.
Synopsis
Declared in <boost/capy/delay.hpp>
class delay_awaitable;
Description
Suspends the calling coroutine until the deadline elapses or the environment's stop token is activated, whichever comes first. Resumption is always posted through the executor, never inline on the timer thread.
Not intended to be named directly; use the delay factory function instead.
Return Value
Returns io_result<>{} (no error) when the timer fires normally, or io_result<>{error::canceled} when cancellation claims the resume before the deadline.
Cancellation
If stop_requested() is true before suspension, the coroutine resumes immediately without scheduling a timer and returns io_result<>{error::canceled}. If stop is requested while suspended, the stop callback claims the resume and posts it through the executor; the pending timer is cancelled on the next await_resume or destructor call.
Thread Safety
A single delay_awaitable must not be awaited concurrently. Multiple independent delay() calls on the same execution_context are safe and share one timer thread.
Member Functions
Name |
Description |
|
Construct an awaitable that waits for |
|
Tear down any registered stop callback and cancel the pending timer if one is still scheduled. |
|
|
Return true for zero or negative durations, completing synchronously without scheduling a timer. |
|
Clean up the stop callback and timer, then return |
|
Suspend the coroutine, scheduling the timer and a stop callback on the environment's executor and stop token. Resumes |
See Also
delay, timeout
Created with MrDocs