bsl::stop_token

Mechanism for observing cancellation requests on a stop state.

Synopsis

Declared in <bslstl_stoptoken.h>

class stop_token;

Description

This class is a mechanism for observing cancellation requests. An object of this class either has (possibly shared) ownership of a stop state and can be used to observe whether a cancellation request has been made on that stop state, or does not own a stop state. A stop_token cannot be used to make a cancellation request.

Type Aliases

NameDescription
callback_type Alias for stop_callback parameterized by t_CALLBACK.

Member Functions

NameDescription
stop_token [constructor]Constructors
~stop_token [destructor]Destroy this object.
operator= Assignment operators
stop_possible Return whether a stop is still possible on the referred stop state.
stop_requested Return whether a stop has been requested on the referred stop state.
swap Exchange the stop states referred to by *this and other.

Friends

NameDescription
bsl::swapExchange the stop states referred to by lhs and rhs.
bsl::operator==Return whether lhs and rhs refer to the same stop state.
bsl::stop_callbackCallback invoked when a stop is requested on an associated stop state.
bsl::stop_sourceMechanism for requesting and observing cancellation on a stop state.