Class WorkerBase
Base class for workers which implements default Worker workflow.
Implements
Namespace: Eco.Core.Utils.Threading
Assembly: Eco.Core.dll
Syntax
public abstract class WorkerBase : Object, IWorker
Constructors
WorkerBase()
Declaration
protected WorkerBase()
Methods
DoWork(CancellationToken)
Actual work performed in this method.
Declaration
protected abstract Task DoWork(CancellationToken token)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.CancellationToken | token |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
ShutdownAsync()
Shutdowns worker by setting cancellation token Eco.Core.Utils.Threading.WorkerBase.cts and waiting for Eco.Core.Utils.Threading.WorkerBase.task to be completed.
Declaration
public Task ShutdownAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Start()
Starts worker with default System.Threading.Tasks.TaskFactory`1.
Declaration
public void Start()
Start(TaskFactory)
Starts worker with taskFactory
System.Threading.Tasks.TaskFactory`1.
Declaration
public void Start(TaskFactory taskFactory)
Parameters
Type | Name | Description |
---|---|---|
System.Threading.Tasks.TaskFactory | taskFactory |