cancellation_token::register_callback Method
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<
typename _Function
>
::Concurrency::cancellation_token_registration register_callback(
const _Function& _Func
) const;
Parameters
_Function
The type of the function object that will be called back when this cancellation_token is canceled._Func
The function object that will be called back when this cancellation_token is canceled.
Return Value
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.
Requirements
Header: pplcancellation_token.h
Namespace: concurrency