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
Datei anzeigen Open project: Scooletz/RampUp

Private Properties

Property Type Description
CreateThreads void
RemoveThreadAffinity void
SetThreadAffinity void
ThreadStartWithAffinity void

Public Methods

Method 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.

Protected Methods

Method 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

Method Description
CreateThreads ( int numberOfThreads, int processorIndexes ) : void
RemoveThreadAffinity ( ) : void
SetThreadAffinity ( int processorIndex ) : void
ThreadStartWithAffinity ( int threadIndex, int processorIndexes ) : void

Method Details

Dispose() public method

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

GetScheduledTasks() protected method

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
return IEnumerable

QueueTask() protected method

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.
return void

RoundRobinThreadAffinedTaskScheduler() public method

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.
return System

TryExecuteTaskInline() protected method

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.
return bool