A scope's stop request: cooperative cancellation. More...
#include "donner/base/tasks/ScopeStop.h"
Static Public Member Functions | |
| static bool | SkipsQueuedTask (const ScopeStop *stop) |
| The check a thread makes before it starts a queued task: true when the task's scope requested a stop, and the task must be destroyed unrun. | |
A scope's stop request: cooperative cancellation.
Once requested, a task of the scope that is still queued is not run when a thread takes it: its closure is destroyed unrun, and it still completes its scope's accounting, so the scope's join returns. A task that has started runs to its end and may poll requested to return early. Spawns that run inline, because the scheduler could not queue them, are not queued and are not skipped.
Every access is relaxed: the request is advisory, publishes no data, and a task that misses a request made concurrently with its start simply runs.
A scope type embeds one and gives its address to each task record it spawns; the scheduler makes the check, SkipsQueuedTask, wherever it starts a queued task, so every scope type that links its flag gets the same behavior.
|
inlinestaticnodiscard |
The check a thread makes before it starts a queued task: true when the task's scope requested a stop, and the task must be destroyed unrun.
| stop | The task's scope's stop request, or null for a task without one. |