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
파일 보기 프로젝트 열기: eropple/sharplike

보호된 프로퍼티들

프로퍼티 타입 설명
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