Async++ unknown
Async (co_await/co_return) code for C++
|
A very basic dispatcher that runs in a single thread until manually stopped. More...
#include <asyncpp/simple_dispatcher.h>
Public Member Functions | |
void | push (std::function< void()> cbfn) override |
Push a function to be executed on the dispatcher. | |
void | stop () noexcept |
Stop the dispatcher. It will return the on the next iteration, regardless if there is any work left. | |
void | run () |
Block and process tasks pushed to it until stop is called. | |
Additional Inherited Members | |
Static Public Member Functions inherited from asyncpp::dispatcher | |
static dispatcher * | current () noexcept |
Static Protected Member Functions inherited from asyncpp::dispatcher | |
static dispatcher * | current (dispatcher *disp) |
Set the current dispatcher for this thread and reurns the current one. Implementers of dispatchers can use this to give convenient access to the current dispatcher, for example for yielding. A dispatcher usually calls this function once at the start of an event loop, before calling any callbacks and persists the return value. It then calls it again after calling all callbacks and restores the previously persisted value. This allows invoking a dispatcher loop from within another dispatcher. The end call is optional if the implementation can guarantee that the thread will terminate afterwards. | |
A very basic dispatcher that runs in a single thread until manually stopped.
|
inlineoverridevirtual |
Push a function to be executed on the dispatcher.
cbfn | The callback |
Implements asyncpp::dispatcher.