Propagates notification that operations should be canceled.
true
. The objects that receive the notification can respond in whatever manner is appropriate. Public Fields | |
static cancellation_token | none |
Represents an empty xtd::threading::cancellation_token value. | |
Public Constructors | |
cancellation_token (bool canceled) | |
Initializes the xtd::threading::cancellation_token. | |
Public Properties | |
bool | can_be_canceled () const noexcept |
Gets whether this token is capable of being in the canceled state. | |
bool | is_cancellation_requested () const noexcept |
Gets whether cancellation has been requested for this token. | |
threading::wait_handle & | wait_handle () noexcept |
Gets a xtd::threading::wait_handle that is signaled when the token is canceled. | |
Public Methods | |
bool | equals (const object &obj) const noexcept override |
Determines whether the specified object is equal to the current object. | |
bool | equals (const cancellation_token &other) const noexcept override |
Determines whether the specified object is equal to the current object. | |
xtd::size | get_hash_code () const noexcept override |
Serves as a hash function for a particular type. | |
void | throw_if_cancellation_requested () const |
Throws a xtd::operation_canceled_exception if this token has had cancellation requested. | |
Additional Inherited Members | |
![]() | |
object ()=default | |
Create a new instance of the ultimate base class object. | |
virtual type_object | get_type () const noexcept |
Gets the type of the current instance. | |
template<class object_t > | |
xtd::uptr< object_t > | memberwise_clone () const |
Creates a shallow copy of the current object. | |
virtual xtd::string | to_string () const noexcept |
Returns a xtd::string that represents the current object. | |
![]() | |
virtual bool | equals (const cancellation_token &) const noexcept=0 |
Indicates whether the current object is equal to another object of the same type. | |
![]() | |
template<class object_a_t , class object_b_t > | |
static bool | equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are considered equal. | |
template<class object_a_t , class object_b_t > | |
static bool | reference_equals (const object_a_t &object_a, const object_b_t &object_b) noexcept |
Determines whether the specified object instances are the same instance. | |
xtd::threading::cancellation_token::cancellation_token | ( | bool | canceled | ) |
Initializes the xtd::threading::cancellation_token.
canceled | The canceled state for the token. |
false
, both xtd::threading::cancellation_token::can_be_canceled and xtd::threading::cancellation_token::is_cancellation_requested will be false
. true
, both xtd::threading::cancellation_token::can_be_canceled and xtd::threading::cancellation_token::is_cancellation_requested will be true
.
|
noexcept |
Gets whether this token is capable of being in the canceled state.
true
if this token is capable of being in the canceled state; otherwise, false
.
|
noexcept |
Gets whether cancellation has been requested for this token.
true
if cancellation has been requested for this token; otherwise, false
. true
, it only guarantees that cancellation has been requested. It does not guarantee that every registered handler has finished executing, nor that cancellation requests have finished propagating to all registered handlers. Additional synchronization may be required, particularly in situations where related objects are being canceled concurrently.
|
noexcept |
Gets a xtd::threading::wait_handle that is signaled when the token is canceled.
|
overridevirtualnoexcept |
Determines whether the specified object is equal to the current object.
obj | The object to compare with the current object. |
true
if the specified object is equal to the current object. otherwise, false
. Reimplemented from xtd::object.
|
overridenoexcept |
Determines whether the specified object is equal to the current object.
other | The object to compare with the current object. |
true
if the specified object is equal to the current object. otherwise, false
.
|
overridevirtualnoexcept |
Serves as a hash function for a particular type.
Reimplemented from xtd::object.
void xtd::threading::cancellation_token::throw_if_cancellation_requested | ( | ) | const |
Throws a xtd::operation_canceled_exception if this token has had cancellation requested.
xtd::operation_canceled_exception | The token has had cancellation requested. |
|
static |
Represents an empty xtd::threading::cancellation_token value.
false
.