C# Class 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.
Inheritance: IScheduler
Afficher le fichier Open project: eropple/sharplike

Protected Properties

Свойство Type Description
priorityList IScheduledTask>.SortedList

Méthodes publiques

Méthode Description
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.

Private Methods

Méthode Description
RunTask ( Object data ) : void

Method Details

AddTask() public méthode

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.
Résultat void

AddTask() public méthode

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.
Résultat void

ClearTasks() public méthode

Clears the scheduler of all tasks.
public ClearTasks ( ) : void
Résultat void

PrioritizedThreadPoolScheduler() public méthode

Constructor.
public PrioritizedThreadPoolScheduler ( ) : System
Résultat System

Process() public méthode

Dispatches a "go" message to all subscribed processes.
public Process ( ) : void
Résultat void

RemoveTask() public méthode

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.
Résultat System.Boolean

ReorderTasks() public méthode

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
Résultat void

Property Details

priorityList protected_oe property

protected SortedList priorityList
Résultat IScheduledTask>.SortedList