Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

cancel_after (3 of 9 overloads)

Create a partial completion token adapter that cancels an operation if not complete before the specified asynchronous operation completes.

template<
    typename Trigger>
constraint_t< is_async_operation< Trigger >::value, partial_cancel_after_trigger< decay_t< Trigger > > > cancel_after(
    Trigger && trigger,
    cancellation_type_t cancel_type = cancellation_type::terminal);
Thread Safety

When an asynchronous operation is used with cancel_after, an additional asynchronous operation is performed in parallel to the main operation. If this parallel operation completes first, a cancellation request is emitted to cancel the main operation. Consequently, the application must ensure that the asynchronous operation is performed within an implicit or explicit strand.


PrevUpHomeNext