Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of Boost. Click here to view this page for the latest version.
PrevUpHomeNext

this_coro::reset_cancellation_state (3 of 3 overloads)

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

template<
    typename InFilter,
    typename OutFilter>
constexpr unspecified reset_cancellation_state(
    InFilter && in_filter,
    OutFilter && out_filter);

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, std::forward<InFilter>(in_filter), std::forward<OutFilter>(out_filter)), into the current coroutine's cancellation state object.

Example
boost::asio::awaitable<void> my_coroutine()
{
  co_await boost::asio::this_coro::reset_cancellation_state(
      boost::asio::enable_partial_cancellation(),
      boost::asio::disable_cancellation());

  // ...
}
Remarks

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


PrevUpHomeNext