Scheduler.SchedulePeriodic(IScheduler, TState, TimeSpan, Func) method¶
Defined in
Type: Scheduler
Namespace: System.Reactive.Concurrency
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IDisposable SchedulePeriodic<TState>(this IScheduler scheduler, TState state, TimeSpan period, Func<TState, TState> action) - 2.
public static IDisposable SchedulePeriodic<TState>(this IScheduler scheduler, TState state, TimeSpan period, Action<TState> action) - 3.
public static IDisposable SchedulePeriodic(this IScheduler scheduler, TimeSpan period, Action action)
1. Overload¶
public static IDisposable SchedulePeriodic<TState>(this IScheduler scheduler, TState state, TimeSpan period, Func<TState, TState> action)
Summary: Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. If the scheduler supports periodic scheduling, the request will be forwarded to the periodic scheduling implementation. If the scheduler provides stopwatch functionality, the periodic task will be emulated using recursive scheduling with a stopwatch to correct for time slippage. Otherwise, the periodic task will be emulated using recursive scheduling.
Type parameters
| Name | Description |
|---|---|
TState | The type of the state passed to the scheduled action. |
Parameters
| Name | Type | Description |
|---|---|---|
scheduler | [IScheduler](# | The scheduler to run periodic work on. |
state | TState | Initial state passed to the action upon the first iteration. |
period | TimeSpan | Period for running the work periodically. |
action | Func | Action to be executed, potentially updating the state. |
Returns: IDisposable -- The disposable object used to cancel the scheduled recurring action (best effort).
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | scheduler or action is null. |
| System.ArgumentOutOfRangeException | period is less than Zero. |
2. Overload¶
public static IDisposable SchedulePeriodic<TState>(this IScheduler scheduler, TState state, TimeSpan period, Action<TState> action)
Summary: Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. If the scheduler supports periodic scheduling, the request will be forwarded to the periodic scheduling implementation. If the scheduler provides stopwatch functionality, the periodic task will be emulated using recursive scheduling with a stopwatch to correct for time slippage. Otherwise, the periodic task will be emulated using recursive scheduling.
Type parameters
| Name | Description |
|---|---|
TState | The type of the state passed to the scheduled action. |
Parameters
| Name | Type | Description |
|---|---|---|
scheduler | [IScheduler](# | Scheduler to execute the action on. |
state | TState | State passed to the action to be executed. |
period | TimeSpan | Period for running the work periodically. |
action | Action | Action to be executed. |
Returns: IDisposable -- The disposable object used to cancel the scheduled recurring action (best effort).
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | scheduler or action is null. |
| System.ArgumentOutOfRangeException | period is less than Zero. |
3. Overload¶
public static IDisposable SchedulePeriodic(this IScheduler scheduler, TimeSpan period, Action action)
Summary: Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities. If the scheduler supports periodic scheduling, the request will be forwarded to the periodic scheduling implementation. If the scheduler provides stopwatch functionality, the periodic task will be emulated using recursive scheduling with a stopwatch to correct for time slippage. Otherwise, the periodic task will be emulated using recursive scheduling.
Parameters
| Name | Type | Description |
|---|---|---|
scheduler | [IScheduler](# | Scheduler to execute the action on. |
period | TimeSpan | Period for running the work periodically. |
action | Action | Action to be executed. |
Returns: IDisposable -- The disposable object used to cancel the scheduled recurring action (best effort).
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | scheduler or action is null. |
| System.ArgumentOutOfRangeException | period is less than Zero. |