Scheduler
Provides a set of static properties to access commonly used schedulers.
Gets a scheduler that schedules work as soon as possible on the current thread.
Gets a scheduler that schedules work on the platform's default scheduler.
Gets a scheduler that schedules work immediately on the current thread.
Gets a scheduler that schedules work on a new thread using default thread creation options.
Gets the current time according to the local machine's system clock.
Gets a scheduler that schedules work on Task Parallel Library (TPL) task pool using the default TaskScheduler.
Gets a scheduler that schedules work on the thread pool.
Returns the ISchedulerLongRunning implementation of the specified scheduler, or null if no such implementation is available.
Returns the ISchedulerPeriodic implementation of the specified scheduler, or null if no such implementation is available.
Returns the IStopwatchProvider implementation of the specified scheduler, or null if no such implementation is available.
public static IScheduler Catch<TException>(this IScheduler scheduler, Func<TException, bool> handler) where TException : Exception
Returns a scheduler that wraps the original scheduler, adding exception handling for scheduled actions.
Returns a scheduler that represents the original scheduler, without any of its interface-based optimizations (e.g. long running scheduling).
public static IScheduler DisableOptimizations(this IScheduler scheduler, Type[] optimizationInterfaces)
Returns a scheduler that represents the original scheduler, without the specified set of interface-based optimizations (e.g. long running scheduling).
Normalizes the specified TimeSpan value to a positive value.
Schedules an action to be executed recursively.
public static IDisposable Schedule<TState>(this IScheduler scheduler, TState state, Action<TState, Action<TState>> action)
Schedules an action to be executed recursively.
public static IDisposable Schedule(this IScheduler scheduler, TimeSpan dueTime, Action<Action<TimeSpan>> action)
Schedules an action to be executed recursively after a specified relative due time.
public static IDisposable Schedule<TState>(this IScheduler scheduler, TState state, TimeSpan dueTime, Action<TState, Action<TState, TimeSpan>> action)
Schedules an action to be executed recursively after a specified relative due time.
public static IDisposable Schedule(this IScheduler scheduler, DateTimeOffset dueTime, Action<Action<DateTimeOffset>> action)
Schedules an action to be executed recursively at a specified absolute due time.
public static IDisposable Schedule<TState>(this IScheduler scheduler, TState state, DateTimeOffset dueTime, Action<TState, Action<TState, DateTimeOffset>> action)
Schedules an action to be executed recursively at a specified absolute due time.
Schedules an action to be executed.
Schedules an action to be executed after the specified relative due time.
public static IDisposable Schedule(this IScheduler scheduler, DateTimeOffset dueTime, Action action)
Schedules an action to be executed at the specified absolute due time.
public static IDisposable ScheduleAsync<TState>(this IScheduler scheduler, TState state, Func<IScheduler, TState, CancellationToken, Task> action)
Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
public static IDisposable ScheduleAsync<TState>(this IScheduler scheduler, TState state, Func<IScheduler, TState, CancellationToken, Task<IDisposable>> action)
Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
public static IDisposable ScheduleAsync(this IScheduler scheduler, Func<IScheduler, CancellationToken, Task> action)
Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
public static IDisposable ScheduleAsync(this IScheduler scheduler, Func<IScheduler, CancellationToken, Task<IDisposable>> action)
Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
public static IDisposable ScheduleAsync<TState>(this IScheduler scheduler, TState state, TimeSpan dueTime, Func<IScheduler, TState, CancellationToken, Task> action)
Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
public static IDisposable ScheduleAsync<TState>(this IScheduler scheduler, TState state, TimeSpan dueTime, Func<IScheduler, TState, CancellationToken, Task<IDisposable>> action)
Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
public static IDisposable ScheduleAsync(this IScheduler scheduler, TimeSpan dueTime, Func<IScheduler, CancellationToken, Task> action)
Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
public static IDisposable ScheduleAsync(this IScheduler scheduler, TimeSpan dueTime, Func<IScheduler, CancellationToken, Task<IDisposable>> action)
Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
public static IDisposable ScheduleAsync<TState>(this IScheduler scheduler, TState state, DateTimeOffset dueTime, Func<IScheduler, TState, CancellationToken, Task> action)
Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
public static IDisposable ScheduleAsync<TState>(this IScheduler scheduler, TState state, DateTimeOffset dueTime, Func<IScheduler, TState, CancellationToken, Task<IDisposable>> action)
Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
public static IDisposable ScheduleAsync(this IScheduler scheduler, DateTimeOffset dueTime, Func<IScheduler, CancellationToken, Task> action)
Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
public static IDisposable ScheduleAsync(this IScheduler scheduler, DateTimeOffset dueTime, Func<IScheduler, CancellationToken, Task<IDisposable>> action)
Schedules work using an asynchronous method, allowing for cooperative scheduling in an imperative coding style.
public static IDisposable ScheduleLongRunning(this ISchedulerLongRunning scheduler, Action<ICancelable> action)
Schedules an action to be executed.
public static IDisposable SchedulePeriodic<TState>(this IScheduler scheduler, TState state, TimeSpan period, Func<TState, TState> action)
Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities.
If the scheduler supports periodic scheduling, the request will be forwarded to the periodic scheduling implementation.
If the scheduler provides stopwatch functionality, the periodic task will be emulated using recursive scheduling with a stopwatch to correct for time slippage.
Otherwise, the periodic task will be emulated using recursive scheduling.
public static IDisposable SchedulePeriodic<TState>(this IScheduler scheduler, TState state, TimeSpan period, Action<TState> action)
Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities.
If the scheduler supports periodic scheduling, the request will be forwarded to the periodic scheduling implementation.
If the scheduler provides stopwatch functionality, the periodic task will be emulated using recursive scheduling with a stopwatch to correct for time slippage.
Otherwise, the periodic task will be emulated using recursive scheduling.
public static IDisposable SchedulePeriodic(this IScheduler scheduler, TimeSpan period, Action action)
Schedules a periodic piece of work by dynamically discovering the scheduler's capabilities.
If the scheduler supports periodic scheduling, the request will be forwarded to the periodic scheduling implementation.
If the scheduler provides stopwatch functionality, the periodic task will be emulated using recursive scheduling with a stopwatch to correct for time slippage.
Otherwise, the periodic task will be emulated using recursive scheduling.
Suspends execution of the current work item on the scheduler for the specified duration.
The caller should await the result of calling Sleep to schedule the remainder of the current work item (known as the continuation) after the specified duration.
public static SchedulerOperation Sleep(this IScheduler scheduler, TimeSpan dueTime, CancellationToken cancellationToken)
Suspends execution of the current work item on the scheduler for the specified duration.
The caller should await the result of calling Sleep to schedule the remainder of the current work item (known as the continuation) after the specified duration.
Suspends execution of the current work item on the scheduler until the specified due time.
The caller should await the result of calling Sleep to schedule the remainder of the current work item (known as the continuation) at the specified due time.
public static SchedulerOperation Sleep(this IScheduler scheduler, DateTimeOffset dueTime, CancellationToken cancellationToken)
Suspends execution of the current work item on the scheduler until the specified due time.
The caller should await the result of calling Sleep to schedule the remainder of the current work item (known as the continuation) at the specified due time.
Starts a new stopwatch object by dynamically discovering the scheduler's capabilities.
If the scheduler provides stopwatch functionality, the request will be forwarded to the stopwatch provider implementation.
Otherwise, the stopwatch will be emulated using the scheduler's notion of absolute time.
Yields execution of the current work item on the scheduler to another work item on the scheduler.
The caller should await the result of calling Yield to schedule the remainder of the current work item (known as the continuation).
public static SchedulerOperation Yield(this IScheduler scheduler, CancellationToken cancellationToken)
Yields execution of the current work item on the scheduler to another work item on the scheduler.
The caller should await the result of calling Yield to schedule the remainder of the current work item (known as the continuation).