Search Results for

    Show / Hide Table of Contents

    Class Cancelable

    A ICancelable that wraps a CancellationTokenSource. When canceling this instance the underlying CancellationTokenSource is canceled as well.

    Inheritance
    object
    Cancelable
    Implements
    ICancelable
    IDisposable
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Akka.Actor
    Assembly: Akka.dll
    Syntax
    public class Cancelable : ICancelable, IDisposable

    Constructors

    | Edit this page View Source

    Cancelable(IActionScheduler)

    Initializes a new instance of the Cancelable class.

    Declaration
    public Cancelable(IActionScheduler scheduler)
    Parameters
    Type Name Description
    IActionScheduler scheduler

    TBD

    | Edit this page View Source

    Cancelable(IActionScheduler, TimeSpan)

    Initializes a new instance of the Cancelable class that will be cancelled after the specified amount of time.

    Declaration
    public Cancelable(IActionScheduler scheduler, TimeSpan delay)
    Parameters
    Type Name Description
    IActionScheduler scheduler

    The scheduler.

    TimeSpan delay

    The delay before the cancelable is canceled.

    | Edit this page View Source

    Cancelable(IScheduler)

    Initializes a new instance of the Cancelable class.

    Declaration
    public Cancelable(IScheduler scheduler)
    Parameters
    Type Name Description
    IScheduler scheduler

    TBD

    | Edit this page View Source

    Cancelable(IScheduler, int)

    Initializes a new instance of the Cancelable class that will be cancelled after the specified amount of milliseconds.

    Declaration
    public Cancelable(IScheduler scheduler, int millisecondsDelay)
    Parameters
    Type Name Description
    IScheduler scheduler

    The scheduler.

    int millisecondsDelay

    The delay in milliseconds.

    | Edit this page View Source

    Cancelable(IScheduler, TimeSpan)

    Initializes a new instance of the Cancelable class that will be cancelled after the specified amount of time.

    Declaration
    public Cancelable(IScheduler scheduler, TimeSpan delay)
    Parameters
    Type Name Description
    IScheduler scheduler

    The scheduler.

    TimeSpan delay

    The delay before the cancelable is canceled.

    Properties

    | Edit this page View Source

    IsCancellationRequested

    Gets a value indicating whether cancellation has been requested

    Declaration
    public bool IsCancellationRequested { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    IsDisposed

    Declaration
    public bool IsDisposed { get; }
    Property Value
    Type Description
    bool
    | Edit this page View Source

    Token

    Gets the CancellationToken associated with this ICancelable.

    Declaration
    public CancellationToken Token { get; }
    Property Value
    Type Description
    CancellationToken

    Methods

    | Edit this page View Source

    Cancel()

    Communicates a request for cancellation.

    Declaration
    public 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.

    | Edit this page View Source

    Cancel(bool)

    Communicates a request for cancellation, and specifies whether remaining callbacks and cancelable operations should be processed.

    Declaration
    public void Cancel(bool throwOnFirstException)
    Parameters
    Type Name Description
    bool throwOnFirstException

    true if exceptions should immediately propagate; otherwise, false.

    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.

    | Edit this page View Source

    CancelAfter(int)

    Schedules a cancel operation on this cancelable after the specified number of milliseconds.

    Declaration
    public void CancelAfter(int millisecondsDelay)
    Parameters
    Type Name Description
    int millisecondsDelay

    The delay in milliseconds before this instance is canceled.

    | Edit this page View Source

    CancelAfter(TimeSpan)

    Schedules a cancel operation on this cancelable after the specified delay.

    Declaration
    public void CancelAfter(TimeSpan delay)
    Parameters
    Type Name Description
    TimeSpan delay

    The delay before this instance is canceled.

    | Edit this page View Source

    CreateCanceled()

    Returns a ICancelable that has already been canceled.

    Declaration
    public static ICancelable CreateCanceled()
    Returns
    Type Description
    ICancelable
    | Edit this page View Source

    CreateLinkedCancelable(IActionScheduler, params ICancelable[])

    Creates a ICancelable that will be in the canceled state when any of the source cancelables are in the canceled state.

    Declaration
    public static ICancelable CreateLinkedCancelable(IActionScheduler scheduler, params ICancelable[] cancelables)
    Parameters
    Type Name Description
    IActionScheduler scheduler

    The scheduler

    ICancelable[] cancelables

    The cancelables instances to observe.

    Returns
    Type Description
    ICancelable

    A new ICancelable that is linked to the source .

    | Edit this page View Source

    CreateLinkedCancelable(IActionScheduler, params CancellationToken[])

    Declaration
    public static ICancelable CreateLinkedCancelable(IActionScheduler scheduler, params CancellationToken[] cancellationTokens)
    Parameters
    Type Name Description
    IActionScheduler scheduler
    CancellationToken[] cancellationTokens
    Returns
    Type Description
    ICancelable
    | Edit this page View Source

    CreateLinkedCancelable(IScheduler, params ICancelable[])

    Creates a ICancelable that will be in the canceled state when any of the source cancelables are in the canceled state.

    Declaration
    public static ICancelable CreateLinkedCancelable(IScheduler scheduler, params ICancelable[] cancelables)
    Parameters
    Type Name Description
    IScheduler scheduler

    The scheduler

    ICancelable[] cancelables

    The cancelables instances to observe.

    Returns
    Type Description
    ICancelable

    A new ICancelable that is linked to the source .

    | Edit this page View Source

    CreateLinkedCancelable(IScheduler, params CancellationToken[])

    Declaration
    public static ICancelable CreateLinkedCancelable(IScheduler scheduler, params CancellationToken[] cancellationTokens)
    Parameters
    Type Name Description
    IScheduler scheduler
    CancellationToken[] cancellationTokens
    Returns
    Type Description
    ICancelable
    | Edit this page View Source

    Dispose()

    Declaration
    public void Dispose()
    | Edit this page View Source

    Dispose(bool)

    Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

    Declaration
    protected virtual void Dispose(bool disposing)
    Parameters
    Type Name Description
    bool disposing

    if set to true the method has been called directly or indirectly by a user's code. Managed and unmanaged resources will be disposed.
    if set to false the method has been called by the runtime from inside the finalizer and only unmanaged resources can be disposed.

    Implements

    ICancelable
    IDisposable

    Extension Methods

    ObjectExtensions.IsDefaultForType<T>(T)
    ObjectExtensions.AsOption<T>(T)
    CancelableExtensions.CancelIfNotNull(ICancelable)
    Extensions.AsInstanceOf<T>(object)
    In this article
    • githubEdit this page
    • View Source
    Back to top
    Contribute
    • Project Chat
    • Discussion Forum
    • Source Code
    Support
    • Akka.NET Support Plans
    • Akka.NET Observability Tools
    • Akka.NET Training & Consulting
    Maintained By
    • Petabridge - The Akka.NET Company
    • Learn Akka.NET