Breyta

Deila með


cancellation_token_source Class

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

Syntax

class cancellation_token_source;

Members

Public Constructors

Name Description
cancellation_token_source Overloaded. Constructs a new cancellation_token_source. The source can be used to flag cancellation of some cancelable operation.
~cancellation_token_source Destructor

Public Methods

Name Description
cancel 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.
create_linked_source Overloaded. Creates a cancellation_token_source which is canceled when the provided token is canceled.
get_token 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.

Public Operators

Name Description
operator!=
operator=
operator==

Inheritance Hierarchy

cancellation_token_source

Requirements

Header: pplcancellation_token.h

Namespace: concurrency

~cancellation_token_source

~cancellation_token_source();

cancel

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;

cancellation_token_source

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
Object to copy or move.

create_linked_source

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
Iterator type.

_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 C++ Standard Library iterator corresponding to the beginning of the range of tokens to listen for cancellation of.

_End
The C++ Standard Library 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.

get_token

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.

operator!=

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

Parameters

_Src
Operand.

Return Value

operator=

cancellation_token_source& operator= (const cancellation_token_source& _Src);

cancellation_token_source& operator= (cancellation_token_source&& _Src);

Parameters

_Src
Operand.

Return Value

operator==

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

Parameters

_Src
Operand.

Return Value

See also

concurrency Namespace