| 1 |
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. |
| 2 |
|
| 3 |
namespace System.Reactive.Concurrency |
| 4 |
{ |
| 5 |
/// <summary> |
| 6 |
/// Represents an object that schedules units of work. |
| 7 |
/// </summary> |
| 8 |
public interface IScheduler |
| 9 |
{ |
| 10 |
/// <summary> |
| 11 |
/// Gets the scheduler's notion of current time. |
| 12 |
/// </summary> |
| 13 |
DateTimeOffset Now { get; } |
| 14 |
|
| 15 |
/// <summary> |
| 16 |
/// Schedules an action to be executed. |
| 17 |
/// </summary> |
| 18 |
/// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam> |
| 19 |
/// <param name="state">State passed to the action to be executed.</param> |
| 20 |
/// <param name="action">Action to be executed.</param> |
| 21 |
/// <returns>The disposable object used to cancel the scheduled action (best effort).</returns> |
| 22 |
IDisposable Schedule<TState>(TState state, Func<IScheduler, TState, IDisposable> action); |
| 23 |
|
| 24 |
/// <summary> |
| 25 |
/// Schedules an action to be executed after dueTime. |
| 26 |
/// </summary> |
| 27 |
/// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam> |
| 28 |
/// <param name="state">State passed to the action to be executed.</param> |
| 29 |
/// <param name="action">Action to be executed.</param> |
| 30 |
/// <param name="dueTime">Relative time after which to execute the action.</param> |
| 31 |
/// <returns>The disposable object used to cancel the scheduled action (best effort).</returns> |
| 32 |
IDisposable Schedule<TState>(TState state, TimeSpan dueTime, Func<IScheduler, TState, IDisposable> action); |
| 33 |
|
| 34 |
/// <summary> |
| 35 |
/// Schedules an action to be executed at dueTime. |
| 36 |
/// </summary> |
| 37 |
/// <typeparam name="TState">The type of the state passed to the scheduled action.</typeparam> |
| 38 |
/// <param name="state">State passed to the action to be executed.</param> |
| 39 |
/// <param name="action">Action to be executed.</param> |
| 40 |
/// <param name="dueTime">Absolute time at which to execute the action.</param> |
| 41 |
/// <returns>The disposable object used to cancel the scheduled action (best effort).</returns> |
| 42 |
IDisposable Schedule<TState>(TState state, DateTimeOffset dueTime, Func<IScheduler, TState, IDisposable> action); |
| 43 |
} |
| 44 |
} |