C# Class RampUp.Threading.RoundRobinThreadAffinedTaskScheduler

An implementation of TaskScheduler which creates an underlying thread pool and set processor affinity to each thread.
Inheritance: System.Threading.Tasks.TaskScheduler, IDisposable
Afficher le fichier Open project: Scooletz/RampUp

Private Properties

Свойство Type Description
CreateThreads void
RemoveThreadAffinity void
SetThreadAffinity void
ThreadStartWithAffinity void

Méthodes publiques

Méthode Description
Dispose ( ) : void

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

RoundRobinThreadAffinedTaskScheduler ( int numberOfThreads ) : System

Create a new RoundRobinThreadAffinedTaskScheduler with a provided number of background threads. Threads are pined to a logical core using a round robin algorithm.

Méthodes protégées

Méthode Description
GetScheduledTasks ( ) : IEnumerable

Generates an enumerable of T:System.Threading.Tasks.Task instances currently queued to the scheduler waiting to be executed.

QueueTask ( Task task ) : void

Queues a T:System.Threading.Tasks.Task to the scheduler.

TryExecuteTaskInline ( Task task, bool taskWasPreviouslyQueued ) : bool

Determines whether the provided T:System.Threading.Tasks.Task can be executed synchronously in this call, and if it can, executes it.

Private Methods

Méthode Description
CreateThreads ( int numberOfThreads, int processorIndexes ) : void
RemoveThreadAffinity ( ) : void
SetThreadAffinity ( int processorIndex ) : void
ThreadStartWithAffinity ( int threadIndex, int processorIndexes ) : void

Method Details

Dispose() public méthode

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
Résultat void

GetScheduledTasks() protected méthode

Generates an enumerable of T:System.Threading.Tasks.Task instances currently queued to the scheduler waiting to be executed.
This scheduler is unable to generate a list of queued tasks at this time.
protected GetScheduledTasks ( ) : IEnumerable
Résultat IEnumerable

QueueTask() protected méthode

Queues a T:System.Threading.Tasks.Task to the scheduler.
The argument is null.
protected QueueTask ( Task task ) : void
task Task The to be queued.
Résultat void

RoundRobinThreadAffinedTaskScheduler() public méthode

Create a new RoundRobinThreadAffinedTaskScheduler with a provided number of background threads. Threads are pined to a logical core using a round robin algorithm.
public RoundRobinThreadAffinedTaskScheduler ( int numberOfThreads ) : System
numberOfThreads int Total number of threads in the pool.
Résultat System

TryExecuteTaskInline() protected méthode

Determines whether the provided T:System.Threading.Tasks.Task can be executed synchronously in this call, and if it can, executes it.
The argument is null. The was already executed.
protected TryExecuteTaskInline ( Task task, bool taskWasPreviouslyQueued ) : bool
task Task The 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.
Résultat bool