System::Threading::CancellationToken class

CancellationToken class

Propagates notification that operations should be canceled. This class provides a mechanism for cooperative cancellation between threads, allowing one thread to notify others that an operation should be canceled.

class CancellationToken : public System::Details::BoxableObjectBase

Methods

MethodDescription
CancellationToken()Default constructor.
get_CanBeCanceled() constGets whether this token is capable of being in the canceled state.
get_IsCancellationRequested() constGets whether cancellation has been requested for this token.
static get_None()Returns an empty System::Threading::CancellationToken value.
Register(const Action<>&) constRegisters a callback that will be invoked when cancellation is requested.
ThrowIfCancellationRequested() constThrows a OperationCanceledException if cancellation has been requested.

Remarks

A CancellationToken can only be canceled through its associated CancellationTokenSource.

See Also