// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the Apache 2.0 License.
// See the LICENSE file in the project root for more information.
namespace System.Reactive.Concurrency
{
///
/// Represents an object that schedules units of work.
///
public interface IScheduler
{
///
/// Gets the scheduler's notion of current time.
///
DateTimeOffset Now { get; }
///
/// Schedules an action to be executed.
///
/// The type of the state passed to the scheduled action.
/// State passed to the action to be executed.
/// Action to be executed.
/// The disposable object used to cancel the scheduled action (best effort).
IDisposable Schedule(TState state, Func action);
///
/// Schedules an action to be executed after dueTime.
///
/// The type of the state passed to the scheduled action.
/// State passed to the action to be executed.
/// Action to be executed.
/// Relative time after which to execute the action.
/// The disposable object used to cancel the scheduled action (best effort).
IDisposable Schedule(TState state, TimeSpan dueTime, Func action);
///
/// Schedules an action to be executed at dueTime.
///
/// The type of the state passed to the scheduled action.
/// State passed to the action to be executed.
/// Action to be executed.
/// Absolute time at which to execute the action.
/// The disposable object used to cancel the scheduled action (best effort).
IDisposable Schedule(TState state, DateTimeOffset dueTime, Func action);
}
}