TKMCancellationTokenSource
This class provides functionality to cancel pending promises. It is a source for cancellation tokens.
The example below demonstrates how to retrieve a CancellationToken and use it to cancel a pending operation.
let cancellationTokenSource = TKMCancellationTokenSource()
let ct = cancellationTokenSource.token
//Pass the token to an asynchronous operation that accepts a CancellationToken
asyncOperation(..., ct).conclude()
// If required, cancellation can be requested as follows:
cancellationTokenSource.requestCancellation()
See also
TKMCancellationToken
See also
TKMPromise<T>
-
Creates a new cancellation token source.
-
Creates a new cancellation token source with cancellation already requested. This eliminates the need to call
requestCancellation()
after instantiation if cancellation is to be requested at instantiation time. -
Returns the
TKMCancellationToken
associated with this instance. -
Requests cancellation of the affected promises.
-
Requests cancellation of the affected promises.