DesignForms
TStaTaskScheduler Class Reference

Provides a scheduler that uses STA threads. More...

Inherits TaskScheduler, and IDisposable.

Public Member Functions

 TStaTaskScheduler (int numberOfThreads)
 Initializes a new instance of the StaTaskScheduler class with the specified concurrency level. More...
 
void Dispose ()
 Cleans up the scheduler by indicating that no more tasks will be queued. This method blocks until all threads successfully shutdown. More...
 

Protected Member Functions

override void QueueTask (Task task)
 Queues a Task to be executed by this scheduler. More...
 
override IEnumerable< Task > GetScheduledTasks ()
 Provides a list of the scheduled tasks for the debugger to consume. More...
 
override bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued)
 Determines whether a Task may be inlined. More...
 

Properties

override int MaximumConcurrencyLevel [get]
 Gets the maximum concurrency level supported by this scheduler. More...
 

Detailed Description

Provides a scheduler that uses STA threads.

Constructor & Destructor Documentation

TStaTaskScheduler ( int  numberOfThreads)

Initializes a new instance of the StaTaskScheduler class with the specified concurrency level.

Parameters
numberOfThreadsThe number of threads that should be created and used by this scheduler.

Member Function Documentation

void Dispose ( )

Cleans up the scheduler by indicating that no more tasks will be queued. This method blocks until all threads successfully shutdown.

override IEnumerable<Task> GetScheduledTasks ( )
protected

Provides a list of the scheduled tasks for the debugger to consume.

Returns
An enumerable of all tasks currently scheduled.
override void QueueTask ( Task  task)
protected

Queues a Task to be executed by this scheduler.

Parameters
taskThe task to be executed.
override bool TryExecuteTaskInline ( Task  task,
bool  taskWasPreviouslyQueued 
)
protected

Determines whether a Task may be inlined.

Parameters
taskThe task to be executed.
taskWasPreviouslyQueuedWhether the task was previously queued.
Returns
true if the task was successfully inlined; otherwise, false.

Property Documentation

override int MaximumConcurrencyLevel
get

Gets the maximum concurrency level supported by this scheduler.