The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

run_with_cancellation_token Function


Executes a function object immediately and synchronously in the context of a given cancellation token.

   typename _Function
void run_with_cancellation_token(
   const _Function& _Func,
   cancellation_token _Ct


The type of the function object that will be invoked.


The function object which will be executed. This object must support the function call operator with a signature of void(void).


The cancellation token which will control implicit cancellation of the function object. Use cancellation_token::none() if you want the function execute without any possibility of implicit cancellation from a parent task group being canceled.

Any interruption points in the function object will be triggered when the cancellation_token is canceled. The explicit token _Ct will isolate this _Func from parent cancellation if the parent has a different token or no token.


Header: ppl.h

Namespace: concurrency