Class Scheduler
Represents timer-based scheduler.
Inherited Members
Namespace: DotNext.Threading
Assembly: DotNext.Threading.dll
Syntax
public static class Scheduler
Methods
| Edit this page View SourceScheduleAsync<TArgs>(Func<TArgs, CancellationToken, ValueTask>, TArgs, TimeSpan, CancellationToken)
Schedules the specific action to be executed once after the specified delay.
Declaration
public static Scheduler.DelayedTask ScheduleAsync<TArgs>(Func<TArgs, CancellationToken, ValueTask> callback, TArgs args, TimeSpan delay, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
Func<TArgs, CancellationToken, ValueTask> | callback | The callback to be executed after the specified delay. |
TArgs | args | The arguments to be passed to the callback. |
TimeSpan | delay | The amount of time used to delay callback execution. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Scheduler.DelayedTask | The task representing delayed execution. |
Type Parameters
Name | Description |
---|---|
TArgs | The type of arguments to be passed to the callback. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentOutOfRangeException |
|
ScheduleAsync<TArgs, TResult>(Func<TArgs, CancellationToken, ValueTask<TResult>>, TArgs, TimeSpan, CancellationToken)
Schedules the specific action to be executed once after the specified delay.
Declaration
public static Scheduler.DelayedTask<TResult> ScheduleAsync<TArgs, TResult>(Func<TArgs, CancellationToken, ValueTask<TResult>> callback, TArgs args, TimeSpan delay, CancellationToken token = default)
Parameters
Type | Name | Description |
---|---|---|
Func<TArgs, CancellationToken, ValueTask<TResult>> | callback | The callback to be executed after the specified delay. |
TArgs | args | The arguments to be passed to the callback. |
TimeSpan | delay | The amount of time used to delay callback execution. |
CancellationToken | token | The token that can be used to cancel the operation. |
Returns
Type | Description |
---|---|
Scheduler.DelayedTask<TResult> | The task representing delayed execution. |
Type Parameters
Name | Description |
---|---|
TArgs | The type of arguments to be passed to the callback. |
TResult | The type of the result to returned from the callback. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
ArgumentOutOfRangeException |
|