C# Класс Sharplike.Core.Scheduling.PrioritizedThreadPoolScheduler

The class for a prioritized scheduler. Internally the class uses SortedList for relatively efficient insertion and deletion of tasks, and is recommended only for multi-threaded schedulers.
Наследование: IScheduler
Показать файл Открыть проект

Защищенные свойства (Protected)

Свойство Тип Описание
priorityList IScheduledTask>.SortedList

Открытые методы

Метод Описание
AddTask ( IScheduledTask task ) : void

Adds a task to the priority queue. As no priority value has been given, the scheduler will use the delegate in TaskPriorityAlgorithm to determine a priority for the task. Failure to set TaskPriorityAlgorithm ahead of time will throw an exception.

AddTask ( Int32 priority, IScheduledTask task ) : void

Adds a task to the scheduler with the specified priority.

ClearTasks ( ) : void

Clears the scheduler of all tasks.

PrioritizedThreadPoolScheduler ( ) : System

Constructor.

Process ( ) : void

Dispatches a "go" message to all subscribed processes.

RemoveTask ( IScheduledTask task ) : System.Boolean

Remove a task from the scheduler. This is a fail-safe function; it will not throw an exception if the task is not in the scheduler. Note that this function only removes the first occasion of a task; if you have accidentally registered the same task multiple times, it only removes one.

ReorderTasks ( ) : void

Feeds all currently enqueued tasks through the designated TaskPriorityAlgorithm to reorder them. This is a computationally slow function and should be called with caution.

Приватные методы

Метод Описание
RunTask ( Object data ) : void

Описание методов

AddTask() публичный Метод

Adds a task to the priority queue. As no priority value has been given, the scheduler will use the delegate in TaskPriorityAlgorithm to determine a priority for the task. Failure to set TaskPriorityAlgorithm ahead of time will throw an exception.
public AddTask ( IScheduledTask task ) : void
task IScheduledTask The task to add to the scheduler.
Результат void

AddTask() публичный Метод

Adds a task to the scheduler with the specified priority.
public AddTask ( Int32 priority, IScheduledTask task ) : void
priority System.Int32 The current task's priority for scheduling.
task IScheduledTask The task to be queued.
Результат void

ClearTasks() публичный Метод

Clears the scheduler of all tasks.
public ClearTasks ( ) : void
Результат void

PrioritizedThreadPoolScheduler() публичный Метод

Constructor.
public PrioritizedThreadPoolScheduler ( ) : System
Результат System

Process() публичный Метод

Dispatches a "go" message to all subscribed processes.
public Process ( ) : void
Результат void

RemoveTask() публичный Метод

Remove a task from the scheduler. This is a fail-safe function; it will not throw an exception if the task is not in the scheduler. Note that this function only removes the first occasion of a task; if you have accidentally registered the same task multiple times, it only removes one.
public RemoveTask ( IScheduledTask task ) : System.Boolean
task IScheduledTask The task to remove.
Результат System.Boolean

ReorderTasks() публичный Метод

Feeds all currently enqueued tasks through the designated TaskPriorityAlgorithm to reorder them. This is a computationally slow function and should be called with caution.
public ReorderTasks ( ) : void
Результат void

Описание свойств

priorityList защищенное свойство

protected SortedList priorityList
Результат IScheduledTask>.SortedList