xtd 0.2.0
xtd::threading::cancellation_token_source Class Reference

Definition

Signals to a xtd::threading::cancellation_token that it should be canceled.

class core_export_ cancellation_token_source : public xtd::object
Inheritance
xtd::objectxtd::threading::cancellation_token_source
Header
#include <xtd/threading/cancellation_token_source>
Namespace
xtd::threading
Library
xtd.core
Remarks
The xtd uses a unified model for cooperative cancellation of asynchronous or long-running synchronous operations that involves two objects:
  • A xtd::threading::cancellation_token_source object, which provides a cancellation token through its xtd::threading::cancellation_token_source::token property and sends a cancellation message by calling its xtd::threading::cancellation_token_source::cancel or xtd::threading::cancellation_token_sourcecancel_after method.
  • A xtd::threading::cancellation_token object, which indicates whether cancellation is requested.
The general pattern for implementing the cooperative cancellation model is:

Constructors

 cancellation_token_source (int32 milliseconds_delay)
 
 cancellation_token_source (const time_span &delay)
 

Proeprties

bool is_cancellation_requested () const noexcept
 
const cancellation_tokentoken () const noexcept
 

Additional Inherited Members

- Public Member Functions inherited from xtd::object
 object ()=default
 Create a new instance of the ultimate base class object. More...
 
bool equals (const object &obj) const noexcept
 Determines whether the specified object is equal to the current object. More...
 
virtual size_t get_hash_code () const noexcept
 Serves as a hash function for a particular type. More...
 
virtual type_object get_type () const noexcept
 Gets the type of the current instance. More...
 
template<typename object_t >
std::unique_ptr< object_t > memberwise_clone () const noexcept
 Creates a shallow copy of the current object. More...
 
virtual xtd::ustring to_string () const noexcept
 Returns a sxd::ustring that represents the current object. More...
 
- Static Public Member Functions inherited from xtd::object
static bool equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are considered equal. More...
 
static bool reference_equals (const object &object_a, const object &object_b) noexcept
 Determines whether the specified object instances are the same instance. More...
 

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