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

cancel_after (4 of 6 overloads)

Adapt a completion token to cancel an operation if not complete before the specified relative timeout has elapsed.

template<
    typename Rep,
    typename Period,
    typename CompletionToken>
cancel_after_t< decay_t< CompletionToken >, chrono::steady_clock > cancel_after(
    const chrono::duration< Rep, Period > & timeout,
    cancellation_type_t cancel_type,
    CompletionToken && completion_token);
Thread Safety

When an asynchronous operation is used with cancel_after, a timer async_wait operation is performed in parallel to the main operation. If this parallel async_wait 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