Class EffectPriorityScheduler
A TaskScheduler with control over concurrency and priority, useful with EffectCompilerCache.
public class EffectPriorityScheduler : TaskScheduler, IDisposable
- Inheritance
-
EffectPriorityScheduler
- Implements
- Inherited Members
- Extension Methods
Constructors
EffectPriorityScheduler(ThreadPriority, int)
public EffectPriorityScheduler(ThreadPriority threadPriority, int maximumConcurrencyLevel)
Parameters
threadPriority
ThreadPrioritymaximumConcurrencyLevel
int
Properties
MaximumConcurrencyLevel
Indicates the maximum concurrency level this TaskScheduler is able to support.
public override int MaximumConcurrencyLevel { get; }
Property Value
- int
Returns an integer that represents the maximum concurrency level. The default scheduler returns MaxValue.
QueuedTaskCount
public int QueuedTaskCount { get; }
Property Value
Methods
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()
GetOrCreatePriorityGroup(int)
Gets the or create a task scheduler for the given priority.
public TaskScheduler GetOrCreatePriorityGroup(int priority)
Parameters
priority
intThe priority.
Returns
GetScheduledTasks()
For debugger support only, generates an enumerable of Task instances currently queued to the scheduler waiting to be executed.
protected override IEnumerable<Task> GetScheduledTasks()
Returns
- IEnumerable<Task>
An enumerable that allows a debugger to traverse the tasks currently queued to this scheduler.
Exceptions
- NotSupportedException
This scheduler is unable to generate a list of queued tasks at this time.
QueueTask(Task)
Queues a Task to the scheduler.
protected override void QueueTask(Task task)
Parameters
Exceptions
- ArgumentNullException
The
task
argument is null.
TryExecuteTaskInline(Task, bool)
Determines whether the provided Task can be executed synchronously in this call, and if it can, executes it.
protected override bool TryExecuteTaskInline(Task task, bool taskWasPreviouslyQueued)
Parameters
task
TaskThe Task to be executed.
taskWasPreviouslyQueued
boolA 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.
Returns
- bool
A Boolean value indicating whether the task was executed inline.
Exceptions
- ArgumentNullException
The
task
argument is null.- InvalidOperationException
The
task
was already executed.