Class DefaultScheduler
Represents an object that schedules units of work on the platform's default scheduler.
Inherited Members
Namespace: System.Reactive.Concurrency
Assembly: System.Reactive.Core.dll
Syntax
public sealed class DefaultScheduler : LocalScheduler, IScheduler, IStopwatchProvider, IServiceProvider, ISchedulerPeriodic
Properties
| Improve this Doc View SourceInstance
Gets the singleton instance of the default scheduler.
Declaration
public static DefaultScheduler Instance { get; }
Property Value
| Type | Description |
|---|---|
| DefaultScheduler |
Methods
| Improve this Doc View SourceGetService(Type)
Discovers scheduler services by interface type.
Declaration
protected override 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. |
Overrides
| Improve this Doc View SourceSchedule<TState>(TState, Func<IScheduler, TState, IDisposable>)
Schedules an action to be executed.
Declaration
public override 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. |
Overrides
Exceptions
| Type | Condition |
|---|---|
| ArgumentNullException |
|
Schedule<TState>(TState, TimeSpan, Func<IScheduler, TState, IDisposable>)
Schedules an action to be executed after dueTime, using a System.Threading.Timer object.
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 |
|
SchedulePeriodic<TState>(TState, TimeSpan, Func<TState, TState>)
Schedules a periodic piece of work, using a System.Threading.Timer object.
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 |
|---|---|
| ArgumentOutOfRangeException |
|
| ArgumentNullException |
|