Search Results for

    Show / Hide Table of Contents

    Class LocalScheduler

    Abstract base class for machine-local schedulers, using the local system clock for time-based operations.

    Inheritance
    Object
    LocalScheduler
    CurrentThreadScheduler
    DefaultScheduler
    EventLoopScheduler
    ImmediateScheduler
    NewThreadScheduler
    SynchronizationContextScheduler
    TaskPoolScheduler
    ThreadPoolScheduler
    Implements
    IScheduler
    IStopwatchProvider
    IServiceProvider
    Inherited Members
    Object.Equals(Object)
    Object.Equals(Object, Object)
    Object.GetHashCode()
    Object.GetType()
    Object.MemberwiseClone()
    Object.ToString()
    Object.ReferenceEquals(Object, Object)
    Namespace: System.Reactive.Concurrency
    Assembly: System.Reactive.Core.dll
    Syntax
    public abstract class LocalScheduler : IScheduler, IStopwatchProvider, IServiceProvider

    Properties

    | Improve this Doc View Source

    Now

    Gets the scheduler's notion of current time.

    Declaration
    public virtual DateTimeOffset Now { get; }
    Property Value
    Type Description
    DateTimeOffset

    Methods

    | Improve this Doc View Source

    GetService(Type)

    Discovers scheduler services by interface type. The base class implementation returns requested services for each scheduler interface implemented by the derived class. For more control over service discovery, derived types can override this method.

    Declaration
    protected virtual object GetService(Type serviceType)
    Parameters
    Type Name Description
    Type serviceType

    Scheduler service interface type to discover.

    Returns
    Type Description
    Object

    Object implementing the requested service, if available; null otherwise.

    | Improve this Doc View Source

    Schedule<TState>(TState, DateTimeOffset, Func<IScheduler, TState, IDisposable>)

    Schedules an action to be executed at dueTime.

    Declaration
    public virtual IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action)
    Parameters
    Type Name Description
    TState state

    State passed to the action to be executed.

    DateTimeOffset dueTime

    Absolute time at which to execute the action.

    Func<IScheduler, TState, IDisposable> action

    Action to be executed.

    Returns
    Type Description
    IDisposable

    The disposable object used to cancel the scheduled action (best effort).

    Type Parameters
    Name Description
    TState

    The type of the state passed to the scheduled action.

    Exceptions
    Type Condition
    ArgumentNullException

    action is null.

    | Improve this Doc View Source

    Schedule<TState>(TState, Func<IScheduler, TState, IDisposable>)

    Schedules an action to be executed.

    Declaration
    public virtual IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action)
    Parameters
    Type Name Description
    TState state

    State passed to the action to be executed.

    Func<IScheduler, TState, IDisposable> action

    Action to be executed.

    Returns
    Type Description
    IDisposable

    The disposable object used to cancel the scheduled action (best effort).

    Type Parameters
    Name Description
    TState

    The type of the state passed to the scheduled action.

    Exceptions
    Type Condition
    ArgumentNullException

    action is null.

    | Improve this Doc View Source

    Schedule<TState>(TState, TimeSpan, Func<IScheduler, TState, IDisposable>)

    Schedules an action to be executed after dueTime.

    Declaration
    public abstract IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action)
    Parameters
    Type Name Description
    TState state

    State passed to the action to be executed.

    TimeSpan dueTime

    Relative time after which to execute the action.

    Func<IScheduler, TState, IDisposable> action

    Action to be executed.

    Returns
    Type Description
    IDisposable

    The disposable object used to cancel the scheduled action (best effort).

    Type Parameters
    Name Description
    TState

    The type of the state passed to the scheduled action.

    | Improve this Doc View Source

    StartStopwatch()

    Starts a new stopwatch object.

    Declaration
    public virtual IStopwatch StartStopwatch()
    Returns
    Type Description
    IStopwatch

    New stopwatch object; started at the time of the request.

    Remarks

    Platform-specific scheduler implementations should reimplement IStopwatchProvider to provide a more efficient IStopwatch implementation (if available).

    Explicit Interface Implementations

    | Improve this Doc View Source

    IServiceProvider.GetService(Type)

    Declaration
    object IServiceProvider.GetService(Type serviceType)
    Parameters
    Type Name Description
    Type serviceType
    Returns
    Type Description
    Object

    Implements

    IScheduler
    IStopwatchProvider
    System.IServiceProvider

    Extension Methods

    Scheduler.DisableOptimizations(IScheduler)
    Scheduler.DisableOptimizations(IScheduler, Type[])
    Scheduler.Catch<TException>(IScheduler, Func<TException, Boolean>)
    Scheduler.SchedulePeriodic<TState>(IScheduler, TState, TimeSpan, Func<TState, TState>)
    Scheduler.SchedulePeriodic<TState>(IScheduler, TState, TimeSpan, Action<TState>)
    Scheduler.SchedulePeriodic(IScheduler, TimeSpan, Action)
    Scheduler.StartStopwatch(IScheduler)
    Scheduler.AsLongRunning(IScheduler)
    Scheduler.AsStopwatchProvider(IScheduler)
    Scheduler.AsPeriodic(IScheduler)
    Scheduler.Schedule(IScheduler, Action<Action>)
    Scheduler.Schedule<TState>(IScheduler, TState, Action<TState, Action<TState>>)
    Scheduler.Schedule(IScheduler, TimeSpan, Action<Action<TimeSpan>>)
    Scheduler.Schedule<TState>(IScheduler, TState, TimeSpan, Action<TState, Action<TState, TimeSpan>>)
    Scheduler.Schedule(IScheduler, DateTimeOffset, Action<Action<DateTimeOffset>>)
    Scheduler.Schedule<TState>(IScheduler, TState, DateTimeOffset, Action<TState, Action<TState, DateTimeOffset>>)
    Scheduler.Schedule(IScheduler, Action)
    Scheduler.Schedule(IScheduler, TimeSpan, Action)
    Scheduler.Schedule(IScheduler, DateTimeOffset, Action)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX