Show / Hide Table of Contents

Class PeriodicWorkerFactory

Inheritance
System.Object
PeriodicWorkerFactory
Namespace: Eco.Core.Utils.Threading
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
Type Description
RepeatableActionWorker

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
Type Description
RepeatableActionWorker

Create(TimeSpan, Action)

Creates a new instance of the RepeatableActionWorker class with specified delay between executions.

Declaration
public static RepeatableActionWorker Create(TimeSpan delay, Action doWork)
Parameters
Type Name Description
System.TimeSpan delay
System.Action doWork
Returns
Type Description
RepeatableActionWorker

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
Type Description
RepeatableActionWorker

CreateWithInterval(TimeSpan, Action)

Creates a new instance of the RepeatableActionWorker class with specified execution interval.

Declaration
public static IntervalActionWorker CreateWithInterval(TimeSpan interval, Action doWork)
Parameters
Type Name Description
System.TimeSpan interval
System.Action doWork
Returns
Type Description
IntervalActionWorker

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
Type Description
IntervalActionWorker
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾