The cancellation_token
class represents the ability to determine whether some operation has been requested to cancel. A given token can be associated with a task_group
, structured_task_group
, or task
to provide implicit cancellation. It can also be polled for cancellation or have a callback registered for if and when the associated cancellation_token_source
is canceled.
More...
#include <pplcancellation_token.h>
The cancellation_token
class represents the ability to determine whether some operation has been requested to cancel. A given token can be associated with a task_group
, structured_task_group
, or task
to provide implicit cancellation. It can also be polled for cancellation or have a callback registered for if and when the associated cancellation_token_source
is canceled.
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
void _Assign(_ImplType _Impl)
Definition: pplcancellation_token.h:773
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
void _Move(_ImplType &_Impl)
Definition: pplcancellation_token.h:782
Concurrency::cancellation_token::~cancellation_token |
( |
| ) |
|
|
inline |
void _Clear()
Definition: pplcancellation_token.h:764
Concurrency::cancellation_token::cancellation_token |
( |
| ) |
|
|
inlineprivate |
#define NULL
Definition: crtdbg.h:30
_ImplType _M_Impl
Definition: pplcancellation_token.h:762
Concurrency::cancellation_token::cancellation_token |
( |
_ImplType |
_Impl | ) |
|
|
inlineprivate |
#define NULL
Definition: crtdbg.h:30
static _CancellationTokenState * _None()
Definition: pplcancellation_token.h:328
long _Reference()
Definition: pplcancellation_token.h:60
_ImplType _M_Impl
Definition: pplcancellation_token.h:762
#define NULL
Definition: crtdbg.h:30
_ImplType _M_Impl
Definition: pplcancellation_token.h:762
void Concurrency::cancellation_token::_Clear |
( |
| ) |
|
|
inlineprivate |
#define NULL
Definition: crtdbg.h:30
long _Release()
Definition: pplcancellation_token.h:71
_ImplType _M_Impl
Definition: pplcancellation_token.h:762
cancellation_token()
Definition: pplcancellation_token.h:788
_ImplType Concurrency::cancellation_token::_GetImpl |
( |
| ) |
const |
|
inline |
_ImplType _M_Impl
Definition: pplcancellation_token.h:762
_ImplType Concurrency::cancellation_token::_GetImplValue |
( |
| ) |
const |
|
inline |
#define NULL
Definition: crtdbg.h:30
static _CancellationTokenState * _None()
Definition: pplcancellation_token.h:328
_ImplType _M_Impl
Definition: pplcancellation_token.h:762
#define NULL
Definition: crtdbg.h:30
_ImplType _M_Impl
Definition: pplcancellation_token.h:762
Removes a callback previously registered via the register
method based on the cancellation_token_registration
object returned at the time of registration.
- Parameters
-
_Registration | The cancellation_token_registration object corresponding to the callback to be deregistered. This token must have been previously returned from a call to the register method. |
void _DeregisterCallback(_In_ _CancellationTokenRegistration *_PRegistration)
Definition: pplcancellation_token.h:415
_ImplType _M_Impl
Definition: pplcancellation_token.h:762
bool Concurrency::cancellation_token::is_cancelable |
( |
| ) |
const |
|
inline |
Returns an indication of whether this token can be canceled or not.
- Returns
- An indication of whether this token can be canceled or not.
#define NULL
Definition: crtdbg.h:30
_ImplType _M_Impl
Definition: pplcancellation_token.h:762
bool Concurrency::cancellation_token::is_canceled |
( |
| ) |
const |
|
inline |
Returns true
if the token has been canceled.
- Returns
- The value
true
if the token has been canceled; otherwise, the value false
.
#define NULL
Definition: crtdbg.h:30
bool _IsCanceled() const
Definition: pplcancellation_token.h:358
_ImplType _M_Impl
Definition: pplcancellation_token.h:762
Returns a cancellation token which can never be subject to cancellation.
- Returns
- A cancellation token that cannot be canceled.
cancellation_token()
Definition: pplcancellation_token.h:788
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
bool operator==(const cancellation_token &_Src) const
Definition: pplcancellation_token.h:663
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
void _Clear()
Definition: pplcancellation_token.h:764
void _Assign(_ImplType _Impl)
Definition: pplcancellation_token.h:773
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
void _Move(_ImplType &_Impl)
Definition: pplcancellation_token.h:782
void _Clear()
Definition: pplcancellation_token.h:764
_In_ size_t _In_z_ const unsigned char * _Src
Definition: mbstring.h:95
_ImplType _M_Impl
Definition: pplcancellation_token.h:762
template<typename _Function >
Registers a callback function with the token. If and when the token is canceled, the callback will be made. Note that if the token is already canceled at the point where this method is called, the callback will be made immediately and synchronously.
- Template Parameters
-
_Function | The type of the function object that will be called back when this cancellation_token is canceled. |
- Parameters
-
_Func | The function object that will be called back when this cancellation_token is canceled. |
- Returns
- A
cancellation_token_registration
object which can be utilized in the deregister
method to deregister a previously registered callback and prevent it from being made. The method will throw an invalid_operation exception if it is called on a cancellation_token
object that was created using the cancellation_token::none method.
722 throw invalid_operation();
724 #pragma warning(suppress: 28197)
725 details::_CancellationTokenCallback<_Function> *_PCallback =
new details::_CancellationTokenCallback<_Function>(_Func);
727 return cancellation_token_registration(_PCallback);
_CancellationTokenRegistration * _RegisterCallback(TaskProc_t _PCallback, _In_ void *_PData, int _InitialRefs=1)
Definition: pplcancellation_token.h:383
#define NULL
Definition: crtdbg.h:30
_ImplType _M_Impl
Definition: pplcancellation_token.h:762
_ImplType Concurrency::cancellation_token::_M_Impl |
|
private |
The documentation for this class was generated from the following file: