ISchedulerPeriodic.cs 1.1 KB

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