Show / Hide Table of Contents

Class EventDrivenWorker

Worker which controlled by Eco.Core.Utils.Threading.EventDrivenWorker.autoResetEvent. It will wait until Eco.Core.Utils.Threading.EventDrivenWorker.autoResetEvent set before every call to DoRepeatableWork(CancellationToken).

Inheritance
System.Object
WorkerBase
RepeatableWorkerBase
EventDrivenWorker
Implements
IWorker
Inherited Members
RepeatableWorkerBase.DoWork(CancellationToken)
WorkerBase.Start()
WorkerBase.Start(TaskFactory)
WorkerBase.ShutdownAsync()
Namespace: Eco.Core.Utils.Threading
Assembly: Eco.Core.dll
Syntax
public class EventDrivenWorker : RepeatableWorkerBase, IWorker

Constructors

EventDrivenWorker(Action, Boolean)

Initializes a new instance of the EventDrivenWorker class with infinite timeout between events.

Declaration
public EventDrivenWorker(Action doWork, bool initialEventState = true)
Parameters
Type Name Description
System.Action doWork
System.Boolean initialEventState

EventDrivenWorker(Func<Int32>, Boolean)

Initializes a new instance of the EventDrivenWorker class with timeout between events defined by return value of repeatableAction function in milliseconds.

Declaration
public EventDrivenWorker(Func<int> repeatableAction, bool initialEventState = true)
Parameters
Type Name Description
System.Func<System.Int32> repeatableAction
System.Boolean initialEventState

EventDrivenWorker(Func<CancellationToken, Task<Int32>>, Boolean)

Initializes a new instance of the EventDrivenWorker class with infinite timeout between events.

Declaration
public EventDrivenWorker(Func<CancellationToken, Task<int>> repeatableAction, bool initialEventState = true)
Parameters
Type Name Description
System.Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<System.Int32>> repeatableAction
System.Boolean initialEventState

EventDrivenWorker(AutoResetEvent, Action)

Initializes a new instance of the EventDrivenWorker class with infinite timeout between events. autoResetEvent should be set for initial doWork execution on Start().

Declaration
public EventDrivenWorker(AutoResetEvent autoResetEvent, Action doWork)
Parameters
Type Name Description
System.Threading.AutoResetEvent autoResetEvent
System.Action doWork

EventDrivenWorker(AutoResetEvent, Func<Int32>)

Initializes a new instance of the EventDrivenWorker class with timeout between events defined by return value of repeatableAction function in milliseconds. autoResetEvent should be set for initial repeatableAction execution on Start().

Declaration
public EventDrivenWorker(AutoResetEvent autoResetEvent, Func<int> repeatableAction)
Parameters
Type Name Description
System.Threading.AutoResetEvent autoResetEvent
System.Func<System.Int32> repeatableAction

EventDrivenWorker(AutoResetEvent, Func<CancellationToken, Task<Int32>>)

Initializes a new instance of the EventDrivenWorker class with infinite timeout between events. autoResetEvent should be set for initial repeatableAction execution on Start().

Declaration
public EventDrivenWorker(AutoResetEvent autoResetEvent, Func<CancellationToken, Task<int>> repeatableAction)
Parameters
Type Name Description
System.Threading.AutoResetEvent autoResetEvent
System.Func<System.Threading.CancellationToken, System.Threading.Tasks.Task<System.Int32>> repeatableAction

Methods

DoRepeatableWork(CancellationToken)

Performs repeatable work, may be cancelled with token.

Declaration
protected override Task DoRepeatableWork(CancellationToken token)
Parameters
Type Name Description
System.Threading.CancellationToken token
Returns
Type Description
System.Threading.Tasks.Task
Overrides
RepeatableWorkerBase.DoRepeatableWork(CancellationToken)

SetEvent()

Declaration
public void SetEvent()

Implements

IWorker

Extension Methods

PropertyChanges.FirePropertyChanged(Object, String)
PropertyChanges.FirePropertyChanged(Object, String, Object, Object)
PropertyChanges.FirePropertyChanged(Object, MemberChangedBeforeAfterEventArgs)
☀
☾
In This Article
Back to top
Copyright (c) Strange Loop Games 2021
☀
☾