Donner SVG main
0.8.0 ยท 766e862a0.8.0 main
SVG editor and embeddable C⁠+⁠+⁠20 engine.
Loading...
Searching...
No Matches
donner::tasks::AsyncTaskScope Class Reference

A scope created, joined once, and destroyed by a coroutine. Its scheduler must outlive it. Keep the coroutine frame alive until its join resumes. On an adopted thread, a submission to an asynchronous scope older than the innermost live synchronous scope fails a release assertion. A younger asynchronous scope may submit. When the target has a slot owned by this caller, its queued work goes to the global queue while the synchronous scope is live. More...

#include "donner/base/tasks/AsyncTaskScope.h"

Classes

class  JoinAwaitable
 The waiting coroutine owns its queue entry until the scheduler resumes it. More...

Public Member Functions

 AsyncTaskScope (TaskScheduler &scheduler)
 AsyncTaskScope (const AsyncTaskScope &)=delete
 AsyncTaskScope (AsyncTaskScope &&)=delete
AsyncTaskScope & operator= (const AsyncTaskScope &)=delete
AsyncTaskScope & operator= (AsyncTaskScope &&)=delete
template<typename F>
void spawn (F &&work)
 Spawns from the creator before join, or from a task of this scope while it is still running. Runs inline if the scheduler has no capacity.
template<typename F>
bool trySpawn (F &&work)
 Returns false and leaves the callable with the caller at a bound.
JoinAwaitable join () noexcept
 Joins after outstanding work finishes. An empty scope completes synchronously.

Friends

class TaskScheduler
class AsyncTaskScopeTestPeer

Detailed Description

A scope created, joined once, and destroyed by a coroutine. Its scheduler must outlive it. Keep the coroutine frame alive until its join resumes. On an adopted thread, a submission to an asynchronous scope older than the innermost live synchronous scope fails a release assertion. A younger asynchronous scope may submit. When the target has a slot owned by this caller, its queued work goes to the global queue while the synchronous scope is live.

Constructor & Destructor Documentation

◆ AsyncTaskScope()

donner::tasks::AsyncTaskScope::AsyncTaskScope ( TaskScheduler & scheduler)
explicit
Parameters
schedulerRuns the scope's tasks and queues its continuation.

The documentation for this class was generated from the following file: