Search Results for

    Show / Hide Table of Contents

    Class NewThreadScheduler

    Represents an object that schedules each unit of work on a separate thread.

    Inheritance
    Object
    LocalScheduler
    NewThreadScheduler
    Implements
    IScheduler
    IStopwatchProvider
    IServiceProvider
    ISchedulerLongRunning
    ISchedulerPeriodic
    Inherited Members
    LocalScheduler.Now
    LocalScheduler.Schedule<TState>(TState, Func<IScheduler, TState, IDisposable>)
    LocalScheduler.Schedule<TState>(TState, DateTimeOffset, Func<IScheduler, TState, IDisposable>)
    LocalScheduler.IServiceProvider.GetService(Type)
    LocalScheduler.GetService(Type)
    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.PlatformServices.dll
    Syntax
    public sealed class NewThreadScheduler : LocalScheduler, IScheduler, IStopwatchProvider, IServiceProvider, ISchedulerLongRunning, ISchedulerPeriodic

    Constructors

    | Improve this Doc View Source

    NewThreadScheduler()

    Creates an object that schedules each unit of work on a separate thread.

    Declaration
    public NewThreadScheduler()
    | Improve this Doc View Source

    NewThreadScheduler(Func<ThreadStart, Thread>)

    Creates an object that schedules each unit of work on a separate thread.

    Declaration
    public NewThreadScheduler(Func<ThreadStart, Thread> threadFactory)
    Parameters
    Type Name Description
    Func<ThreadStart, Thread> threadFactory

    Factory function for thread creation.

    Exceptions
    Type Condition
    ArgumentNullException

    threadFactory is null.

    Properties

    | Improve this Doc View Source

    Default

    Gets an instance of this scheduler that uses the default Thread constructor.

    Declaration
    public static NewThreadScheduler Default { get; }
    Property Value
    Type Description
    NewThreadScheduler

    Methods

    | Improve this Doc View Source

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

    Schedules an action to be executed after dueTime.

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

    Overrides
    System.Reactive.Concurrency.LocalScheduler.Schedule<TState>(TState, System.TimeSpan, System.Func<System.Reactive.Concurrency.IScheduler, TState, System.IDisposable>)
    Exceptions
    Type Condition
    ArgumentNullException

    action is null.

    | Improve this Doc View Source

    ScheduleLongRunning<TState>(TState, Action<TState, ICancelable>)

    Schedules a long-running task by creating a new thread. Cancellation happens through polling.

    Declaration
    public IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action)
    Parameters
    Type Name Description
    TState state

    State passed to the action to be executed.

    Action<TState, ICancelable> 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

    SchedulePeriodic<TState>(TState, TimeSpan, Func<TState, TState>)

    Schedules a periodic piece of work by creating a new thread that goes to sleep when work has been dispatched and wakes up again at the next periodic due time.

    Declaration
    public IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action)
    Parameters
    Type Name Description
    TState state

    Initial state passed to the action upon the first iteration.

    TimeSpan period

    Period for running the work periodically.

    Func<TState, TState> action

    Action to be executed, potentially updating the state.

    Returns
    Type Description
    IDisposable

    The disposable object used to cancel the scheduled recurring 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.

    ArgumentOutOfRangeException

    period is less than TimeSpan.Zero.

    | Improve this Doc View Source

    StartStopwatch()

    Starts a new stopwatch object.

    Declaration
    public override IStopwatch StartStopwatch()
    Returns
    Type Description
    IStopwatch

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

    Overrides
    LocalScheduler.StartStopwatch()

    Implements

    IScheduler
    IStopwatchProvider
    System.IServiceProvider
    ISchedulerLongRunning
    ISchedulerPeriodic

    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)
    Scheduler.ScheduleLongRunning(ISchedulerLongRunning, Action<ICancelable>)
    • Improve this Doc
    • View Source
    In This Article
    Back to top Generated by DocFX