Share via


cancellation_token_source Class

The cancellation_token_source class represents the ability to cancel an operation.

class cancellation_token_source;

Members

Public Constructors

Name

Description

cancellation_token_source::cancellation_token_source Constructor

Overloaded. Constructs a cancellation_token_source object.

cancellation_token_source::~cancellation_token_source Destructor

Destructs the cancellation_token_source object.

Public Methods

Name

Description

cancellation_token_source::cancel Method

Cancels the token source and all the tokens associated with it.

cancellation_token_source::create_linked_source Method

Overloaded. Creates a cancellation_token_source which will be canceled when an input token is canceled.

cancellation_token_source::get_token Method

Returns a cancellation_token associated with this source.

Public Operators

Name

Description

cancellation_token_source::operator!= Operator

Determines whether two cancellation_token_source objects represent two different token sources.

cancellation_token_source::operator= Operator

Overloaded. Replaces the contents of one cancellation_token_source object with another.

cancellation_token_source::operator== Operator

Determines whether two cancellation_token_source objects represent the same token source.

Remarks

cancellation_token_source can be used to request cancellation of a cancelable operation.

Use the cancel method to set all cancellation_token objects that are associated with this cancellation_token_source as canceled.

cancellation_token_source behaves like a smart pointer and is safe to pass around by value.

Inheritance Hierarchy

cancellation_token_source

Requirements

Header: ppl.h

Namespace: concurrency

See Also

Reference

concurrency Namespace