cancellation_token Class
The cancellation_token class represents the ability to determine whether some operation has been requested to cancel.
class cancellation_token;
Members
Public Constructors
Name |
Description |
---|---|
Overloaded. Constructs a cancellation_token object. |
|
Destructs the cancellation_token object. |
Public Methods
Name |
Description |
---|---|
Unregisters a callback function that is invoked when the cancellation token is canceled. |
|
Returns an indication of whether this token can be canceled or not. |
|
Returns true if the token has been canceled. |
|
Returns a cancellation token which can never be subject to cancellation. |
|
Registers a callback function that is invoked when the cancellation token is canceled. |
Public Operators
Name |
Description |
---|---|
Determines whether two cancellation_token objects represent two different underlyign tokens. |
|
Overloaded. Replaces the contents of one cancellation_token object with another. |
|
Determines whether two cancellation_token objects represent the same underlying token. |
Remarks
Multiple cancellation_token objects can be linked to one cancellation_token_source object. When you call the cancel method on a token source, all the linked cancellation_token objects are set as canceled.
A given cancellation_token object can be associated with a task_group, structured_task_group, or task to provide implicit cancellation. It can also be polled for cancellation information or have a callback registered and called when it is canceled.
cancellation_token behaves like a smart pointer and is safe to pass around by value.
For more info about task cancellation, see Cancellation in the PPL.
Inheritance Hierarchy
cancellation_token
Requirements
Header: ppl.h
Namespace: concurrency