Interface ICancelable
Signifies something that can be canceled
Namespace: Akka.Actor
Assembly: Akka.dll
Syntax
public interface ICancelable
Properties
| Improve this Doc View SourceIsCancellationRequested
Gets a value indicating whether cancellation has been requested
Declaration
bool IsCancellationRequested { get; }
Property Value
Type | Description |
---|---|
Boolean |
Token
Gets the CancellationToken associated with this ICancelable.
Declaration
CancellationToken Token { get; }
Property Value
Type | Description |
---|---|
CancellationToken |
Methods
| Improve this Doc View SourceCancel()
Communicates a request for cancellation.
Declaration
void Cancel()
Remarks
The associated cancelable will be notified of the cancellation and will transition
to a state where IsCancellationRequested returns true
.
Any callbacks or cancelable operations registered with the cancelable will be executed.
Cancelable operations and callbacks registered with the token should not throw exceptions.
However, this overload of Cancel will aggregate any exceptions thrown into an
AggregateException, such that one callback throwing an exception will not
prevent other registered callbacks from being executed.
The ExecutionContext that was captured when each callback was registered will
be reestablished when the callback is invoked.
Cancel(Boolean)
Communicates a request for cancellation, and specifies whether remaining callbacks and cancelable operations should be processed.
Declaration
void Cancel(bool throwOnFirstException)
Parameters
Type | Name | Description |
---|---|---|
Boolean | throwOnFirstException |
|
Remarks
The associated cancelable will be notified of the cancellation and will transition
to a state where IsCancellationRequested returns true
.
Any callbacks or cancelable operations registered with the cancelable will be executed.
Cancelable operations and callbacks registered with the token should not throw exceptions.
If throwOnFirstException
is true
, an exception will immediately
propagate out of the call to Cancel, preventing the remaining callbacks and cancelable operations
from being processed.
If throwOnFirstException
is false
, this overload will aggregate any exceptions
thrown into an AggregateException, such that one callback throwing an exception will not
prevent other registered callbacks from being executed.
The ExecutionContext that was captured when each callback was registered will be
reestablished when the callback is invoked.
CancelAfter(Int32)
Schedules a cancel operation on this cancelable after the specified number of milliseconds.
Declaration
void CancelAfter(int millisecondsDelay)
Parameters
Type | Name | Description |
---|---|---|
Int32 | millisecondsDelay | The delay in milliseconds before this instance is canceled. |
CancelAfter(TimeSpan)
Schedules a cancel operation on this cancelable after the specified delay.
Declaration
void CancelAfter(TimeSpan delay)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | delay | The delay before this instance is canceled. |