|
BDE 4.14.0 Production release
|
#include <bslstl_stoptoken.h>
Public Member Functions | |
| stop_source () | |
| stop_source (nostopstate_t) BSLS_KEYWORD_NOEXCEPT | |
| stop_source (const stop_source &original) BSLS_KEYWORD_NOEXCEPT | |
| stop_source (BloombergLP::bslmf::MovableRef< stop_source > original) BSLS_KEYWORD_NOEXCEPT | |
| stop_source (bsl::allocator< char > allocator) | |
| ~stop_source () | |
| Destroy this object. | |
| stop_source & | operator= (const stop_source &other) BSLS_KEYWORD_NOEXCEPT |
| stop_source & | operator= (BloombergLP::bslmf::MovableRef< stop_source > other) BSLS_KEYWORD_NOEXCEPT |
| void | swap (stop_source &other) BSLS_KEYWORD_NOEXCEPT |
| bool | request_stop () BSLS_KEYWORD_NOEXCEPT |
| BSLA_NODISCARD stop_token | get_token () const BSLS_KEYWORD_NOEXCEPT |
| BSLA_NODISCARD bool | stop_possible () const BSLS_KEYWORD_NOEXCEPT |
| BSLA_NODISCARD bool | stop_requested () const BSLS_KEYWORD_NOEXCEPT |
Friends | |
| BSLA_NODISCARD friend bool | operator== (const stop_source &lhs, const stop_source &rhs) BSLS_KEYWORD_NOEXCEPT |
| BSLA_NODISCARD friend bool | operator!= (const stop_source &lhs, const stop_source &rhs) BSLS_KEYWORD_NOEXCEPT |
| void | swap (stop_source &lhs, stop_source &rhs) BSLS_KEYWORD_NOEXCEPT |
This class is a mechanism for making and observing cancellation requests. An object of this class may have (possibly shared) ownership of a stop state, in which case it can be used to make a cancellation request or observe whether a cancellation request has been made on the owned stop state; it is also possible for a stop_source object to not own a stop state. Due to its shared ownership semantics, it is safe to pass a copy of a stop_source object to a callback that might outlive the original stop_source object; however, a callback that should only be able to observe a cancellation request, without being able to request cancellation itself, should instead be passed a stop_token , which can be created by calling stop_source::get_token.
See bslstl_stoptoken
| bsl::stop_source::stop_source | ( | ) |
Create a stop_source object that refers to a distinct stop state, using the currently installed default allocator to supply memory.
|
inlineexplicit |
Create a stop_source object that does not refer to a stop state and, therefore, cannot be used to request a stop.
| bsl::stop_source::stop_source | ( | const stop_source & | original | ) |
Create a stop_source object that refers to the same stop state (or lack thereof) as the specified 'original.
|
inline |
Create a stop_source object that refers to the stop state (or lack thereof) referred to by the specified original, and reset original to not refer to a stop state.
|
explicit |
Create a stop_source object that refers to a distinct stop state, using the specified allocator to supply memory. Note, however, that stop_source is not allocator-aware.
| bsl::stop_source::~stop_source | ( | ) |
| BSLA_NODISCARD stop_token bsl::stop_source::get_token | ( | ) | const |
Return a stop_token that refers to the stop state (or lack thereof) that *this refers to.
| stop_source & bsl::stop_source::operator= | ( | BloombergLP::bslmf::MovableRef< stop_source > | other | ) |
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.
| stop_source & bsl::stop_source::operator= | ( | const stop_source & | other | ) |
Set this object to refer to the same stop state (or lack thereof) as the specified other object.
| bool bsl::stop_source::request_stop | ( | ) |
If *this refers to a stop state and that stop state has not had a stop requested yet, atomically request a stop on that stop state, invoke all registered callbacks in an unspecified order, and finally return true. Otherwise, return false. If this function returns true, the call synchronizes with any call to stop_requested that returns true. A call to request_stop that is potentially concurrent with a call to stop_requested , stop_possible , or request_stop does not cause a data race.
| BSLA_NODISCARD bool bsl::stop_source::stop_possible | ( | ) | const |
Return true if *this refers to a stop state, and false otherwise. A call to stop_possible that is potentially concurrent with a call to stop_requested , stop_possible , or request_stop does not cause a data race.
| BSLA_NODISCARD bool bsl::stop_source::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 , stop_possible , or request_stop does not cause a data race.
|
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).
|
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.
|
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], [stopsource.general]).
|
friend |
Set lhs to refer to the stop state (or lack thereof) that rhs referred to before the call, and vice versa. Implementation note: this function is required by the standard to be a hidden friend ([hidden.friends], [stopsource.general]).