21class awaitable_stop_token {
23 awaitable_stop_token(awaitable_stop_token &&)
noexcept =
default;
24 awaitable_stop_token &operator=(awaitable_stop_token &&)
noexcept =
default;
26 awaitable_stop_token(awaitable_stop_token
const &other) noexcept : _stop_token(other._stop_token), _stop_callback_ptr() {}
28 awaitable_stop_token &operator=(awaitable_stop_token
const &other)
noexcept
30 _stop_callback_ptr =
nullptr;
31 _stop_token = other._stop_token;
35 awaitable_stop_token(std::stop_token
const &stop_token) noexcept : _stop_token(stop_token), _stop_callback_ptr()
39 [[nodiscard]]
bool await_ready()
const noexcept
41 return _stop_token.stop_requested();
44 void await_suspend(std::coroutine_handle<> handle)
noexcept;
46 void await_resume()
noexcept {
47 _stop_callback_ptr =
nullptr;
51 struct callback_wrapper {
52 void operator()()
noexcept;
55 std::coroutine_handle<> handle;
58 std::stop_token _stop_token;