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


  • _Function
    The type of the function object that will be invoked.

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

  • _Ct
    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

See Also


concurrency Namespace