The cancellation_token class represents the ability to determine whether some operation has been requested to cancel.
class cancellation_token;
|
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. |
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.