class
SchedulerThread
Represents a single worker thread within Scheduler.
Public
Constructors
Methods
GetMessageQueue
Returns a message queue that may be used for posting messages to this thread.
staticGet
Returns the scheduler thread bound to the current thread.
Fields
Id
Unique identifier of the scheduler thread.
Private
Methods
Start
Starts execution of the thread.
Must be called before enqueuing any work.
Stop
Stops execution of the thread.
This will block until all pending tasks have finished. Must be called before shutdown.
Wait
Suspends execution of the current task until the task is woken up via a call to Enqueue() or timeout expires.
See Fiber::Wait() overloads for more information.
Wait
Suspends execution of the current task until the task is woken up via a call to Enqueue() or timeout expires.
See Fiber::Wait() overloads for more information.
WaitWithoutLocking
Suspends execution of the current task until the task is woken up via a call to Enqueue() or timeout expires.
See Fiber::Wait() overloads for more information. Mutex must be locked when this is called.
Enqueue
Enqueues a new unstarted task.
Only safe to use if mode is SingleThreaded.
TryLockForEnqueue
Attempts to lock the object for task enqueuing.
Returns true if the lock was successful, after which caller must call EnqueueAndUnlock. You should use this instead of Enqueue() if the mode is MultiThreaded.
EnqueueAndUnlock
Enqueues a task and unlocks the lock acquired via TryLock().
RunUntilShutdown
Processes all tasks and fibers until there are no more and shutdown flag is set.
TryStealTask
Attempts to steal a Task from another worker.
Returns true if a task was successfully stolen.
SwitchExecutionToFiber
Switches execution to the provided fiber.
RunUntilIdle
Executes all pending tasks and returns.
WaitForWork
Waits until some work is available, first spinning and then potentially yielding the thread to the OS.
SpinForWork
Attempts to steal work from another Worker, and keeps the thread awake for a short duration, hoping to find some work before we need to yield to OS.
UpdateWaitingFibers
Enqueues any fibers that have finished waiting.
WaitOnAddedSignal
Waits until the mAddedSignal is notified and predicate returns true.