ISchedulerLongRunning.cs 1.3 KB

1234567891011121314151617181920212223242526
  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 starting long-running tasks.
  7. /// This type of scheduler can be used to run loops more efficiently instead of using recursive scheduling.
  8. /// </summary>
  9. public interface ISchedulerLongRunning
  10. {
  11. /// <summary>
  12. /// Schedules a long-running piece of work.
  13. /// </summary>
  14. /// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam>
  15. /// <param name="state">State passed to the action to be executed.</param>
  16. /// <param name="action">Action to be executed.</param>
  17. /// <returns>The disposable object used to cancel the scheduled action (best effort).</returns>
  18. /// <remarks>
  19. /// <para><b>Notes to implementers</b></para>
  20. /// The returned disposable object should not prevent the work from starting, but only set the cancellation flag passed to the specified action.
  21. /// </remarks>
  22. IDisposable ScheduleLongRunning<TState>(TState state, Action<TState, ICancelable> action);
  23. }
  24. }