A single-threaded cooperatively scheduled runtime for async tasks.
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. | |
| void | LogRegisteredTasks () |
| uint32_t | tasks_polled () const |
| uint32_t | tasks_completed () const |
| Returns the total number of tasks the dispatcher has run to completion. | |
| pw::async2::backend::NativeDispatcher & | native () |
| Returns a reference to the native backend-specific dispatcher type. | |
|
inline |
Outputs log statements about the tasks currently registered with this dispatcher.
|
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.
|
inline |
Returns the total number of times the dispatcher has called a task's Pend() method.