Class EventLoopScheduler
Represents an object that schedules units of work on a designated thread.
Inherited Members
Namespace: System.Reactive.Concurrency
Assembly: System.Reactive.PlatformServices.dll
Syntax
public sealed class EventLoopScheduler : LocalScheduler, IScheduler, IStopwatchProvider, IServiceProvider, ISchedulerPeriodic, IDisposable
Constructors
| Improve this Doc View SourceEventLoopScheduler()
Creates an object that schedules units of work on a designated thread.
Declaration
public EventLoopScheduler()
EventLoopScheduler(Func<ThreadStart, Thread>)
Creates an object that schedules units of work on a designated thread, using the specified factory to control thread creation options.
Declaration
public EventLoopScheduler(Func<ThreadStart, Thread> threadFactory)
Parameters
Type | Name | Description |
---|---|---|
Func<ThreadStart, Thread> | threadFactory | Factory function for thread creation. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Methods
| Improve this Doc View SourceDispose()
Ends the thread associated with this scheduler. All remaining work in the scheduler queue is abandoned.
Declaration
public void Dispose()
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
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ObjectDisposedException | The scheduler has been disposed and doesn't accept new work. |
SchedulePeriodic<TState>(TState, TimeSpan, Func<TState, TState>)
Schedules a periodic piece of work on the designated thread.
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 |
|
ArgumentOutOfRangeException |
|
ObjectDisposedException | The scheduler has been disposed and doesn't accept new work. |
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. |