![]() |
Home | Libraries | People | FAQ | More |
Adapt a completion token to cancel an operation if not complete before the specified asynchronous operation completes.
template< typename Trigger, typename CompletionToken> constraint_t< is_async_operation< Trigger >::value, cancel_after_trigger< decay_t< CompletionToken >, decay_t< Trigger > > > cancel_after( Trigger && trigger, CompletionToken && completion_token);
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.