ITask interface
A unit of work the scheduler runs on one of its fibers.
- Use
#include <ThinkMeta.ConcurrentTasks/Core.h>- Namespace
ThinkMeta::ConcurrentTasks- Inherits
INotifyTaskStateChange
Syntax
struct ITask : INotifyTaskStateChangeRemarks
The object is owned by the caller and must stay alive from ITaskScheduler::AddTask until its INotifyTaskStateChange::OnTaskExited has been called.
See also
Methods
Run
The task's body.
Syntax
virtual void Run() noexcept = 0;Remarks
Run once per ITaskScheduler::AddTask on a scheduler thread. It may suspend (wait on synchronization primitives), yield and sleep; the thread runs other tasks meanwhile.
SetNotifyCallback
Sets the object that is told when the task exits.
Syntax
virtual void SetNotifyCallback(
INotifyTaskStateChange* notifyTaskStateChange
) noexcept = 0;Parameters
notifyTaskStateChangeINotifyTaskStateChange*- The observer, borrowed: it must stay valid until the task has exited.
nullptr: none.
Remarks
The core never calls it; it lets code that did not create the task observe its end (see Tasks::Task).
See also
GetTimerData
Returns the task's timer storage.
Syntax
virtual TaskTimerData* GetTimerData() noexcept;Return value
Type: TaskTimerData*
Storage owned by the task object and valid as long as it lives, or nullptr (the default) if the task cannot be started by time.
Remarks
Needed only to start the task by time (ITaskScheduler::AddTimedTask): a task that has not started has no task context yet. A task that returns nullptr - one without state, say - cannot be started by time; it can still sleep and wait with a timeout.
See also
Generated from ThinkMeta.ConcurrentTasks.API @ 137ec1d (2026-10-17).