Basic dispatcher interface class.
More...
#include <asyncpp/dispatcher.h>
|
virtual void | push (std::function< void()> cbfn)=0 |
|
|
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.
|
|
Basic dispatcher interface class.
◆ current() [1/2]
static dispatcher * asyncpp::dispatcher::current |
( |
| ) |
|
|
inlinestaticnoexcept |
Get the dispatcher associated with the current thread. This can be used to shedule more tasks on the current dispatcher. Returns the current dispatcher, or nullptr if the current thread is not associated with a dispatcher.
◆ current() [2/2]
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.
- Parameters
-
d | The dispatcher instance of this thread. |
- Returns
- The previous dispatcher
◆ push()
virtual void asyncpp::dispatcher::push |
( |
std::function< void()> | cbfn | ) |
|
|
pure virtual |
The documentation for this class was generated from the following file: