A single-threaded cooperatively-scheduled runtime for async tasks. More...
#include <dispatcher.h>
Public Member Functions | |
Dispatcher ()=default | |
Constructs a new async Dispatcher. | |
Dispatcher (Dispatcher &)=delete | |
Dispatcher (Dispatcher &&)=delete | |
Dispatcher & | operator= (Dispatcher &)=delete |
Dispatcher & | operator= (Dispatcher &&)=delete |
void | Post (Task &task) |
Poll | RunUntilStalled () |
Runs tasks until none are able to make immediate progress. | |
Poll | RunUntilStalled (Task &task) |
template<typename Pendable > | |
Poll< PendOutputOf< Pendable > > | RunPendableUntilStalled (Pendable &pendable) |
void | RunToCompletion () |
Runs until all tasks complete. | |
void | RunToCompletion (Task &task) |
Runs until task completes. | |
template<typename Pendable > | |
PendOutputOf< Pendable > | RunPendableToCompletion (Pendable &pendable) |
Runs until pendable completes, returning the output of pendable . | |
pw::async2::backend::NativeDispatcher & | native () |
Returns a reference to the native backend-specific dispatcher type. | |
A single-threaded cooperatively-scheduled runtime for async tasks.
|
inline |
Tells the Dispatcher
to run Task
to completion. This method does not block.
After Post
is called, Task::Pend
will be invoked once. If Task::Pend
does not complete, the Dispatcher
will wait until the Task
is "awoken", at which point it will call Pend
again until the Task
completes.
This method is thread-safe and interrupt-safe.
|
inline |
Runs tasks until none are able to make immediate progress, or until pendable
completes.
Returns a Poll
containing the possible output of pendable
.
Runs tasks until none are able to make immediate progress, or until task
completes.
Returns whether task
completed.