ISuspendCallback interface
Receives the handle of the task that has just been suspended.
On this page
- Use
#include <ThinkMeta.ConcurrentTasks/Core.h>- Namespace
ThinkMeta::ConcurrentTasks- Platforms
- Windows, Linux
Syntax
struct ISuspendCallbackSee also
Methods
OnSuspended
Called once the suspending task is off the processor.
Syntax
virtual void OnSuspended(SuspendedTask suspendedTask) noexcept = 0;Parameters
suspendedTaskSuspendedTask- The task's handle. The waiter publishes it here (e.g. pushes it onto its wait list) or, if the condition it waits for has already come true, passes it straight to
ResumeTask.
Remarks
Runs on the scheduler thread, outside any task (for a converted thread: on that thread, before it blocks), so it must not suspend, yield or wait. From the moment the handle is published a resumer on another thread may resume the task, so the callback must not touch the waiter's state after publishing unless it knows the task cannot run yet.
See also
OnWithdraw
Asks the waiter to take a suspended task back, so the core can end its wait early.
Syntax
virtual bool OnWithdraw([[maybe_unused]] SuspendedTask suspendedTask) noexcept;Parameters
suspendedTaskSuspendedTask- The handle
OnSuspendedreceived for this suspension; the waiter removes it from where it was published if it is still there.
Return value
Type: bool
true if the waiter took the task back from wherever OnSuspended published it: the core then resumes it with the reason it ended the wait for. false if a resumer took the task first; the core then waits for that resumer's ResumeTask.
Remarks
Called while the task is still suspended, when a SuspendTaskFor times out (on the core's timer thread) or its task is cancelled (on the thread that calls CancelTask, or on a scheduler thread). Must be short, must not resume the task itself and must not cancel a task. The default, false, makes a wait neither time out nor end on a cancel.
Generated from ThinkMeta.ConcurrentTasks.API @ c7663c4 (2026-11-19).