BDE 4.14.0 Production release
Loading...
Searching...
No Matches
bsl::stop_token Class Reference

#include <bslstl_stoptoken.h>

Public Member Functions

 stop_token () BSLS_KEYWORD_NOEXCEPT
 Create a stop_token object that does not refer to a stop state.
 
 stop_token (const stop_token &original) BSLS_KEYWORD_NOEXCEPT
 
 stop_token (BloombergLP::bslmf::MovableRef< stop_token > original) BSLS_KEYWORD_NOEXCEPT
 
 ~stop_token ()
 Destroy this object.
 
stop_tokenoperator= (const stop_token &other) BSLS_KEYWORD_NOEXCEPT
 
stop_tokenoperator= (BloombergLP::bslmf::MovableRef< stop_token > other) BSLS_KEYWORD_NOEXCEPT
 
void swap (stop_token &other) BSLS_KEYWORD_NOEXCEPT
 
BSLA_NODISCARD bool stop_possible () const BSLS_KEYWORD_NOEXCEPT
 
BSLA_NODISCARD bool stop_requested () const BSLS_KEYWORD_NOEXCEPT
 

Friends

class stop_source
 
template<class t_CALLBACK >
class stop_callback
 
BSLA_NODISCARD friend bool operator== (const stop_token &lhs, const stop_token &rhs) BSLS_KEYWORD_NOEXCEPT
 
BSLA_NODISCARD friend bool operator!= (const stop_token &lhs, const stop_token &rhs) BSLS_KEYWORD_NOEXCEPT
 
void swap (stop_token &lhs, stop_token &rhs) BSLS_KEYWORD_NOEXCEPT
 

Detailed 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.

See bslstl_stoptoken

Constructor & Destructor Documentation

◆ stop_token() [1/3]

bsl::stop_token::stop_token ( )
inline

◆ stop_token() [2/3]

bsl::stop_token::stop_token ( const stop_token original)
inline

Create a stop_token object that refers to the same stop state (or lack thereof) as the specified original object.

◆ stop_token() [3/3]

bsl::stop_token::stop_token ( BloombergLP::bslmf::MovableRef< stop_token original)
inline

Create a stop_token object that refers to the same stop state (or lack) thereof as the specified original object, and reset original to not refer to a stop state.

◆ ~stop_token()

bsl::stop_token::~stop_token ( )
inline

Member Function Documentation

◆ operator=() [1/2]

stop_token & bsl::stop_token::operator= ( BloombergLP::bslmf::MovableRef< stop_token other)
inline

Set this object to refer to the stop state (or lack thereof) that the specified other object refers to, and reset other to not refer to a stop state.

◆ operator=() [2/2]

stop_token & bsl::stop_token::operator= ( const stop_token other)
inline

Set this object to refer to the same stop state (or lack thereof) as the specified other object.

◆ stop_possible()

BSLA_NODISCARD bool bsl::stop_token::stop_possible ( ) const

Return true if *this refers to a stop state, and either a stop was already requested on that stop state or there is at least one stop_source object that refers to that stop state (implying that a stop could still be requested using the request_stop function), and false otherwise. A call to stop_possible that is potentially concurrent with a call to stop_requested or stop_possible does not cause a data race.

◆ stop_requested()

BSLA_NODISCARD bool bsl::stop_token::stop_requested ( ) const

Return true if *this refers to a stop state on which request_stop has been called, and false otherwise. If this function returns true, then the successful call to request_stop synchronizes with this call. A call to stop_requested that is potentially concurrent with a call to stop_requested or stop_possible does not cause a data race.

◆ swap()

void bsl::stop_token::swap ( stop_token other)
inline

Set *this to refer to the stop state (or lack thereof) that the specified other referred to, and vice versa. Equivalent to swap(*this, other).

Friends And Related Symbol Documentation

◆ operator!=

BSLA_NODISCARD friend bool operator!= ( const stop_token lhs,
const stop_token rhs 
)
friend

Return true if the specified lhs and rhs refer to different stop states, or if only one refers to a stop state; false otherwise.

◆ operator==

BSLA_NODISCARD friend bool operator== ( const stop_token lhs,
const stop_token rhs 
)
friend

Return true if the specified lhs and rhs refer to the same stop state, or if neither refers to a stop state; false otherwise. Implementation note: this function is required by the standard to be a hidden friend ([hidden.friends], [stoptoken.general]).

◆ stop_callback

template<class t_CALLBACK >
friend class stop_callback
friend

◆ stop_source

friend class stop_source
friend

◆ swap

void swap ( stop_token lhs,
stop_token rhs 
)
friend

Set lhs to refer to the stop state (or lack thereof) that rhs referred to, and vice versa. Implementation note: this function is required by the standard to be a hidden friend ([hidden.friends], [stoptoken.general]).


The documentation for this class was generated from the following file: