7#include <asyncpp/fire_and_forget.h>
8#include <asyncpp/simple_dispatcher.h>
9#include <asyncpp/task.h>
13int main(
int argc,
const char** argv) {
14 using asyncpp::eager_fire_and_forget_task;
16 simple_dispatcher disp;
17 std::pair<int, std::exception_ptr> result{-1,
nullptr};
19 [](simple_dispatcher* disp, std::pair<int, std::exception_ptr>& result,
int argc,
20 const char** argv) -> eager_fire_and_forget_task<> {
22 result.first =
co_await async_main(argc, argv);
24 result.second = std::current_exception();
28 }(&disp, result, argc, argv);
31 if (result.second) std::rethrow_exception(result.second);
A very basic dispatcher that runs in a single thread until manually stopped.
Definition simple_dispatcher.h:14
void push(std::function< void()> cbfn) override
Push a function to be executed on the dispatcher.
Definition simple_dispatcher.h:25
Generic task type.
Definition task.h:88