Class PeriodicWorkerFactory
Inheritance
System.Object
PeriodicWorkerFactory
Assembly: Eco.Core.dll
Syntax
public static class PeriodicWorkerFactory : Object
Methods
Create(Func<Task<TimeSpan>>)
Creates a new instance of the PeriodicWorkerFactory class from function which returns delay before next work.
Declaration
public static RepeatableActionWorker Create(Func<Task<TimeSpan>> doWork)
Parameters
Type |
Name |
Description |
System.Func<System.Threading.Tasks.Task<System.TimeSpan>> |
doWork |
|
Returns
Create(Func<TimeSpan>)
Creates a new instance of the PeriodicWorkerFactory class from function which returns delay before next work.
Declaration
public static RepeatableActionWorker Create(Func<TimeSpan> doWork)
Parameters
Type |
Name |
Description |
System.Func<System.TimeSpan> |
doWork |
|
Returns
Create(TimeSpan, Action)
Declaration
public static RepeatableActionWorker Create(TimeSpan delay, Action doWork)
Parameters
Type |
Name |
Description |
System.TimeSpan |
delay |
|
System.Action |
doWork |
|
Returns
Create(TimeSpan, Action<CancellationToken>)
Creates a new instance of the RepeatableActionWorker class with specified interval between executions with cancellation support.
Declaration
public static RepeatableActionWorker Create(TimeSpan delay, Action<CancellationToken> doWork)
Parameters
Type |
Name |
Description |
System.TimeSpan |
delay |
|
System.Action<System.Threading.CancellationToken> |
doWork |
|
Returns
CreateWithInterval(TimeSpan, Action)
Declaration
public static IntervalActionWorker CreateWithInterval(TimeSpan interval, Action doWork)
Parameters
Type |
Name |
Description |
System.TimeSpan |
interval |
|
System.Action |
doWork |
|
Returns
CreateWithInterval(TimeSpan, Func<CancellationToken, Task>)
Creates a new instance of the RepeatableActionWorker class from async action with specified execution interval.
Declaration
public static IntervalActionWorker CreateWithInterval(TimeSpan interval, Func<CancellationToken, Task> doWork)
Parameters
Type |
Name |
Description |
System.TimeSpan |
interval |
|
System.Func<System.Threading.CancellationToken, System.Threading.Tasks.Task> |
doWork |
|
Returns