asio C++ library

PrevUpHomeNext

this_coro::cancellation_state

Awaitable object that returns the cancellation state of the current coroutine.

constexpr cancellation_state_t cancellation_state;
Example
asio::awaitable<void> my_coroutine()
{
  asio::cancellation_state cs
    = co_await asio::this_coro::cancellation_state;

  // ...

  if (cs.cancelled() != asio::cancellation_type::none)
    // ...
}
Requirements

Header: asio/this_coro.hpp

Convenience header: asio.hpp


PrevUpHomeNext