CodePorting.Translator Cs2Cpp
CodePorting.Translator.Cs2Cpp.Framework
|
Propagates notification that operations should be canceled. This class provides a mechanism for cooperative cancellation between threads, allowing one thread to notify others that an operation should be canceled. More...
#include <cancellation_token.h>
Inherits System::Details::BoxableObjectBase.
Public Member Functions | |
CancellationToken () | |
Default constructor. More... | |
bool | get_IsCancellationRequested () const |
Gets whether cancellation has been requested for this token. More... | |
bool | get_CanBeCanceled () const |
Gets whether this token is capable of being in the canceled state. More... | |
CancellationTokenRegistration | Register (const Action<> &callback) const |
Registers a callback that will be invoked when cancellation is requested. More... | |
void | ThrowIfCancellationRequested () const |
Throws a OperationCanceledException if cancellation has been requested. More... | |
Static Public Member Functions | |
static CancellationToken | get_None () |
Returns an empty System::Threading::CancellationToken value. More... | |
Propagates notification that operations should be canceled. This class provides a mechanism for cooperative cancellation between threads, allowing one thread to notify others that an operation should be canceled.
System::Threading::CancellationToken::CancellationToken | ( | ) |
Default constructor.
Creates a token that will never be canceled (equivalent to None).
bool System::Threading::CancellationToken::get_CanBeCanceled | ( | ) | const |
Gets whether this token is capable of being in the canceled state.
bool System::Threading::CancellationToken::get_IsCancellationRequested | ( | ) | const |
Gets whether cancellation has been requested for this token.
|
static |
Returns an empty System::Threading::CancellationToken value.
CancellationTokenRegistration System::Threading::CancellationToken::Register | ( | const Action<> & | callback | ) | const |
Registers a callback that will be invoked when cancellation is requested.
callback | The Action<> to execute when cancellation is requested. |
void System::Threading::CancellationToken::ThrowIfCancellationRequested | ( | ) | const |
Throws a OperationCanceledException if cancellation has been requested.
OperationCanceledException | if get_IsCancellationRequested is true. |