| 1 |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. |
| 2 |
|
| 3 |
using System.Reactive.Disposables; |
| 4 |
|
| 5 |
namespace System.Reactive.Concurrency |
| 6 |
{ |
| 7 |
/// <summary> |
| 8 |
/// Scheduler with support for running periodic tasks. |
| 9 |
/// This type of scheduler can be used to run timers more efficiently instead of using recursive scheduling. |
| 10 |
/// </summary> |
| 11 |
public interface ISchedulerPeriodic |
| 12 |
{ |
| 13 |
/// <summary> |
| 14 |
/// Schedules a periodic piece of work. |
| 15 |
/// </summary> |
| 16 |
/// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam> |
| 17 |
/// <param name="state">Initial state passed to the action upon the first iteration.</param> |
| 18 |
/// <param name="period">Period for running the work periodically.</param> |
| 19 |
/// <param name="action">Action to be executed, potentially updating the state.</param> |
| 20 |
/// <returns>The disposable object used to cancel the scheduled recurring action (best effort).</returns> |
| 21 |
IDisposable SchedulePeriodic<TState>(TState state, TimeSpan period, Func<TState, TState> action); |
| 22 |
} |
| 23 |
} |