Beef Corlib
Public Member Functions | Protected Member Functions | Properties | List of all members
System.Threading.Tasks.ThreadPoolTaskScheduler Class Reference
Inheritance diagram for System.Threading.Tasks.ThreadPoolTaskScheduler:
System.Threading.Tasks.TaskScheduler

Public Member Functions

 ThreadPoolTaskScheduler ()
 Constructs a new ThreadPool task scheduler object.
 

Protected Member Functions

override void QueueTask (Task task)
 Schedules a task to the ThreadPool. More...
 
override bool TryExecuteTaskInline (Task task, bool taskWasPreviouslyQueued)
 This internal function will do this: (1) If the task had previously been queued, attempt to pop it and return false if that fails. More...
 
override bool TryDequeue (Task task)
 
override void NotifyWorkItemProgress ()
 Notifies the scheduler that work is progressing (no-op).
 
- Protected Member Functions inherited from System.Threading.Tasks.TaskScheduler
bool TryRunInline (Task task, bool taskWasPreviouslyQueued)
 
void InternalQueueTask (Task task)
 

Properties

override bool RequiresAtomicStartTransition [get]
 This is the only scheduler that returns false for this property, indicating that the task entry codepath is unsafe (CAS free) since we know that the underlying scheduler already takes care of atomic transitions from queued to non-queued.
 
- Properties inherited from System.Threading.Tasks.TaskScheduler
static TaskScheduler Default [get]
 
static TaskScheduler?? Current [get]
 
static TaskSchedulerInternalCurrent [get]
 
virtual bool RequiresAtomicStartTransition [get]
 

Member Function Documentation

◆ QueueTask()

override void System.Threading.Tasks.ThreadPoolTaskScheduler.QueueTask ( Task  task)
inlineprotectedvirtual

Schedules a task to the ThreadPool.

Parameters
taskThe task to schedule.

Implements System.Threading.Tasks.TaskScheduler.

◆ TryExecuteTaskInline()

override bool System.Threading.Tasks.ThreadPoolTaskScheduler.TryExecuteTaskInline ( Task  task,
bool  taskWasPreviouslyQueued 
)
inlineprotectedvirtual

This internal function will do this: (1) If the task had previously been queued, attempt to pop it and return false if that fails.

(2) Propagate the return value from Task.ExecuteEntry() back to the caller.

IMPORTANT NOTE: TryExecuteTaskInline will NOT throw task exceptions itself. Any wait code path using this function needs to account for exceptions that need to be propagated, and throw themselves accordingly.

Implements System.Threading.Tasks.TaskScheduler.