Table of Contents

Class DistributedQueueTaskScheduler

Namespace
Hi.Parallels
Assembly
HiGeom.dll

A task scheduler that distributes tasks across multiple threads or processes. Allows for controlled execution of tasks with a specified maximum concurrency level.

public class DistributedQueueTaskScheduler : TaskScheduler, IDisposable
Inheritance
DistributedQueueTaskScheduler
Implements
Inherited Members
Extension Methods

Constructors

DistributedQueueTaskScheduler(DistributedQueueTaskStarter, int, int)

Initializes a new instance of the DistributedQueueTaskScheduler class.

public DistributedQueueTaskScheduler(DistributedQueueTaskStarter starter, int maxIdlingTaskNum, int maxWorkingTaskNum)

Parameters

starter DistributedQueueTaskStarter

The task starter responsible for distributing tasks.

maxIdlingTaskNum int

The maximum number of tasks that can be queued.

maxWorkingTaskNum int

The maximum number of tasks that can be executed concurrently.

Properties

MaxWorkingTaskNum

Gets the maximum number of tasks that can be executed concurrently.

public int MaxWorkingTaskNum { get; }

Property Value

int

Methods

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

Dispose(bool)

Releases the unmanaged resources used by the DistributedQueueTaskScheduler and optionally releases the managed resources.

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

GetScheduledTasks()

Gets the tasks currently scheduled for execution.

protected override IEnumerable<Task> GetScheduledTasks()

Returns

IEnumerable<Task>

An enumerable of the tasks currently scheduled.

QueueTask(Task)

Queues a task to the scheduler.

protected override void QueueTask(Task task)

Parameters

task Task

The task to be queued.

TryExecuteTaskInline(Task, bool)

Tries to execute a task synchronously on the current thread.

protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)

Parameters

task Task

The task to be executed.

taskWasPreviouslyQueued bool

Whether the task was previously queued to the scheduler.

Returns

bool

true if the task was successfully executed; otherwise, false.

WaitAll()

Waits for all queued tasks to complete.

public void WaitAll()

Events

Ending

Event that is raised when a worker thread ends processing tasks.

public event Action Ending

Event Type

Action

Starting

Event that is raised when a worker thread starts processing tasks.

public event Action Starting

Event Type

Action