asio C++ library

PrevUpHomeNext

this_coro::reset_cancellation_state (1 of 3 overloads)

Returns an awaitable object that may be used to reset the cancellation state of the current coroutine.

constexpr unspecified reset_cancellation_state();

Let P be the cancellation slot associated with the current coroutine's co_spawn completion handler. Assigns a new cancellation_state object S, constructed as S(P), into the current coroutine's cancellation state object.

Example
asio::awaitable<void> my_coroutine()
{
  co_await asio::this_coro::reset_cancellation_state();

  // ...
}
Remarks

The cancellation state is shared by all coroutines in the same "thread of execution" that was created using co_spawn.


PrevUpHomeNext