Table of Contents

Class PriorityBasedTaskScheduler

Namespace
Hi.Parallels
Assembly
HiGeom.dll

A task scheduler that executes tasks with a specified thread priority.

public class PriorityBasedTaskScheduler : TaskScheduler
Inheritance
PriorityBasedTaskScheduler
Inherited Members
Extension Methods

Constructors

PriorityBasedTaskScheduler(ThreadPriority)

Initializes a new instance.

public PriorityBasedTaskScheduler(ThreadPriority threadPriority)

Parameters

threadPriority ThreadPriority

The thread priority for executing tasks.

Properties

MaxDegreeOfParallelism

Max Degree Of Parallelism. Set special value 0 for no limiting.

public int MaxDegreeOfParallelism { get; set; }

Property Value

int

ThreadPriority

Gets or sets the thread priority for executing tasks.

public ThreadPriority ThreadPriority { get; set; }

Property Value

ThreadPriority

Methods

GetScheduledTasks()

For debugger support only, generates an enumerable of Task instances currently queued to the scheduler waiting to be executed.

protected override IEnumerable<Task> GetScheduledTasks()

Returns

IEnumerable<Task>

An enumerable that allows a debugger to traverse the tasks currently queued to this scheduler.

Exceptions

NotSupportedException

This scheduler is unable to generate a list of queued tasks at this time.

QueueTask(Task)

Queues a Task to the scheduler.

protected override void QueueTask(Task task)

Parameters

task Task

The Task to be queued.

Exceptions

ArgumentNullException

The task argument is null.

TryExecuteTaskInline(Task, bool)

Determines whether the provided Task can be executed synchronously in this call, and if it can, executes it.

protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)

Parameters

task Task

The Task to be executed.

taskWasPreviouslyQueued bool

A Boolean denoting whether or not task has previously been queued. If this parameter is True, then the task may have been previously queued (scheduled); if False, then the task is known not to have been queued, and this call is being made in order to execute the task inline without queuing it.

Returns

bool

A Boolean value indicating whether the task was executed inline.

Exceptions

ArgumentNullException

The task argument is null.

InvalidOperationException

The task was already executed.