Windows apps
Collapse the table of content
Expand the table of content
Information
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.

cancellation_token_source Class

 

The new home for Visual Studio documentation is Visual Studio 2017 Documentation on docs.microsoft.com.

The cancellation_token_source class represents the ability to cancel some cancelable operation.

class cancellation_token_source;

Public Constructors

NameDescription
cancellation_token_source::cancellation_token_source ConstructorOverloaded. Constructs a new cancellation_token_source. The source can be used to flag cancellation of some cancelable operation.
cancellation_token_source::~cancellation_token_source Destructor

Public Methods

NameDescription
cancellation_token_source::cancel MethodCancels the token. Any task_group, structured_task_group, or task which utilizes the token will be canceled upon this call and throw an exception at the next interruption point.
cancellation_token_source::create_linked_source MethodOverloaded. Creates a cancellation_token_source which is canceled when the provided token is canceled.
cancellation_token_source::get_token MethodReturns a cancellation token associated with this source. The returned token can be polled for cancellation or provide a callback if and when cancellation occurs.

Public Operators

NameDescription
cancellation_token_source::operator!= Operator
cancellation_token_source::operator= Operator
cancellation_token_source::operator== Operator

cancellation_token_source

Header: pplcancellation_token.h

Namespace: concurrency

~cancellation_token_source();

Cancels the token. Any task_group, structured_task_group, or task which utilizes the token will be canceled upon this call and throw an exception at the next interruption point.

void cancel() const;

Constructs a new cancellation_token_source. The source can be used to flag cancellation of some cancelable operation.

cancellation_token_source();

cancellation_token_source(const cancellation_token_source& _Src);

cancellation_token_source(cancellation_token_source&& _Src);

Parameters

_Src

Creates a cancellation_token_source which is canceled when the provided 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. Note that the returned token source can also be canceled independently of the source contained in this parameter.

_Begin
The STL iterator corresponding to the beginning of the range of tokens to listen for cancellation of.

_End
The STL iterator corresponding to the ending of the range of tokens to listen for cancellation of.

Return Value

A cancellation_token_source which is canceled when the token provided by the _Src parameter is canceled.

Returns a cancellation token associated with this source. The returned token can be polled for cancellation or provide a callback if and when cancellation occurs.

cancellation_token get_token() const;

Return Value

A cancellation token associated with this source.

bool operator!= (const cancellation_token_source& _Src) const;

Parameters

_Src

Return Value

cancellation_token_source& operator= (const cancellation_token_source& _Src);

cancellation_token_source& operator= (cancellation_token_source&& _Src);

Parameters

_Src

Return Value

bool operator== (const cancellation_token_source& _Src) const;

Parameters

_Src

Return Value

concurrency Namespace

Show:
© 2017 Microsoft