Share via


cancellation_token_source::create_linked_source Method

Creates a cancellation_token_source which will be canceled when an input token is canceled.

static cancellation_token_source create_linked_source(
   cancellation_token& _Src
);

template<
   typename _Iter
>
static cancellation_token_source create_linked_source(
   _Iter_Begin,
   _Iter_End
);

Parameters

  • _Iter

  • _Src
    A token whose cancellation will cause cancellation of the returned token source. You may cancel the returned token source independently of the token source for the passed in token.

  • _Begin
    The position of the first token in the range of tokens to link to.

  • _End
    The position of the first token beyond the range of tokens to link to.

Return Value

A cancellation_token_source which is canceled when any token provided as an input is canceled.

Remarks

By default, a cancellation_token is controlled by its associated cancellation_token_source. Use this method when you want to cascade cancellation from one cancellation_token to another cancellation_token_source and its associated cancellation tokens.

The version of this method that takes an iterator range, will create a cancellation_token_source linked to all cancellation_tokens in that interater range.

Requirements

Header: ppl.h

Namespace: concurrency

See Also

Reference

cancellation_token_source Class