NanoByte.Common
2.6.1
|
Propagates notification that operations should be canceled. More...
Public Member Functions | |
CancellationTokenRegistration | Register (Action callback) |
Registers a delegate that will be called when cancellation has been requested. More... | |
void | ThrowIfCancellationRequested () |
Throws an OperationCanceledException if cancellation has been requested. More... | |
override string | ToString () |
Static Public Member Functions | |
static implicit | operator System.Threading.CancellationToken (CancellationToken token) |
Converts a NanoByte.Common cancellation token to a regular .NET cancellation token. More... | |
static implicit | operator CancellationToken (System.Threading.CancellationToken token) |
Converts a regular .NET cancellation token to a NanoByte.Common cancellation token. More... | |
Package Functions | |
CancellationToken (CancellationTokenSource source) | |
Creates a new token controlled by a specific CancellationTokenSource. More... | |
Properties | |
bool | IsCancellationRequested [get] |
Indicates whether cancellation has been requested. More... | |
WaitHandle | WaitHandle [get] |
Gets a wait handle that is signaled when cancellation has been requested. More... | |
Propagates notification that operations should be canceled.
Unlike the built-in CancellationToken type of .NET the NanoByte.Common variant supports remoting.
|
inlinepackage |
Creates a new token controlled by a specific CancellationTokenSource.
|
inlinestatic |
Converts a regular .NET cancellation token to a NanoByte.Common cancellation token.
|
inlinestatic |
Converts a NanoByte.Common cancellation token to a regular .NET cancellation token.
CancellationTokenRegistration NanoByte.Common.Tasks.CancellationToken.Register | ( | Action | callback | ) |
Registers a delegate that will be called when cancellation has been requested.
callback | The delegate to be executed when cancellation has been requested. |
The callback is called from a background thread. Wrap via synchronization context to update UI elements. Handling this blocks the task, therefore observers should handle the event quickly.
|
inline |
Throws an OperationCanceledException if cancellation has been requested.
OperationCanceledException | Cancellation has been requested. |
|
get |
Indicates whether cancellation has been requested.
|
get |
Gets a wait handle that is signaled when cancellation has been requested.