C# Класс RampUp.Threading.RoundRobinThreadAffinedTaskScheduler

An implementation of TaskScheduler which creates an underlying thread pool and set processor affinity to each thread.
Наследование: System.Threading.Tasks.TaskScheduler, IDisposable
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
CreateThreads void
RemoveThreadAffinity void
SetThreadAffinity void
ThreadStartWithAffinity void

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

Метод Описание
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.

Защищенные методы

Метод Описание
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.

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

Метод Описание
CreateThreads ( int numberOfThreads, int processorIndexes ) : void
RemoveThreadAffinity ( ) : void
SetThreadAffinity ( int processorIndex ) : void
ThreadStartWithAffinity ( int threadIndex, int processorIndexes ) : void

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

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

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public Dispose ( ) : void
Результат void

GetScheduledTasks() защищенный Метод

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
Результат IEnumerable

QueueTask() защищенный Метод

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.
Результат void

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

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.
Результат System

TryExecuteTaskInline() защищенный Метод

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.
Результат bool