IDispatcherScheduler interface
A scheduler that runs its tasks on a thread with an event loop of its own, such as a UI thread.
On this page
- Use
#include <ThinkMeta.ConcurrentTasks/Core.h>- Namespace
ThinkMeta::ConcurrentTasks- Inherits
ITaskScheduler
Syntax
struct IDispatcherScheduler : ITaskSchedulerRemarks
Created by CreateDispatcherScheduler on that thread, which it is bound to. The scheduler has no threads; the event loop drives it. A task starts with RunTask, typically from an event handler, and runs at once until it ends or waits. When a waiting task can go on (ResumeTask, AddTask, a timer), the scheduler hands it to the loop through the DispatcherWakeProc, and the loop passes it to ContinueTask. The bound thread stays an ordinary thread: only the tasks can wait. A task always returns to whoever entered it last, so handlers that start or continue tasks get control back before they return themselves; tasks may also be started or continued from within other tasks and from modal loops inside them. Start does nothing. Stop and Destroy are called once no task waits or is on its way to the loop; Stop on the bound thread.
See also
Methods
RunTask
Runs a task now, on the bound thread.
Syntax
virtual void RunTask(ITask* task) noexcept = 0;Parameters
taskITask*- The task to run; required. Owned by the caller and must stay valid until its
INotifyTaskStateChange::OnTaskExitedhas been called.
Remarks
Returns when the task has ended or waits. Only on the bound thread.
ContinueTask
Runs a task the scheduler handed to the event loop, on the bound thread.
Syntax
virtual void ContinueTask(SuspendedTask task) noexcept = 0;Parameters
taskSuspendedTask- A handle the
DispatcherWakeProcof this scheduler received; each exactly once.
Remarks
Continues a task that was resumed or yielded, or starts one added by AddTask. Returns when the task has ended or waits again. Only on the bound thread.
Generated from ThinkMeta.ConcurrentTasks.API @ e29892d (2026-10-30).