boost::capy::delay

Suspend the current coroutine for a duration.

Synopsis

Declared in <boost/capy/delay.hpp>

template<
    typename Rep,
    typename Period>
delay_awaitable
delay(std::chrono::duration<Rep, Period> dur) noexcept;

Description

Returns an IoAwaitable that completes at or after the specified duration, or earlier if the environment's stop token is activated. Completion is always normal (void return); no exception is thrown on cancellation.

Zero or negative durations complete synchronously without scheduling a timer.

Example

co_await delay(std::chrono::milliseconds(100));

Return Value

A delay_awaitable whose await_resume returns void.

Parameters

Name Description

dur

The duration to wait.

See Also

timeout, delay_awaitable

Created with MrDocs