13 template <
class R,
class P>
14 constexpr SleepAwaiter(std::chrono::duration<R, P> dur, ExecutorRef exec =
nullptr)
16 dur(std::chrono::duration_cast<Duration>(dur)) {}
18 template <
class C,
class D>
19 constexpr SleepAwaiter(std::chrono::time_point<C, D> time, ExecutorRef exec =
nullptr)
22 constexpr void setExecutor(ExecutorRef ex) { exec = ex; }
24 constexpr bool await_ready()
const noexcept {
return dur <= Duration{0}; }
25 void await_suspend(std::coroutine_handle<> handle) { exec->executeAfter(handle, dur); }
26 constexpr void await_resume()
const noexcept {}