Async++ unknown
Async (co_await/co_return) code for C++
Loading...
Searching...
No Matches
asyncpp::simple_dispatcher Class Reference

A very basic dispatcher that runs in a single thread until manually stopped. More...

#include <asyncpp/simple_dispatcher.h>

Inheritance diagram for asyncpp::simple_dispatcher:
[legend]

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 dispatchercurrent () noexcept
 
- Static Protected Member Functions inherited from asyncpp::dispatcher
static dispatchercurrent (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.
 

Detailed Description

A very basic dispatcher that runs in a single thread until manually stopped.

Member Function Documentation

◆ push()

void asyncpp::simple_dispatcher::push ( std::function< void()> cbfn)
inlineoverridevirtual

Push a function to be executed on the dispatcher.

Parameters
cbfnThe callback

Implements asyncpp::dispatcher.


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