#ifndef _ASYNCO_ #define _ASYNCO_ #include "runner.hpp" using namespace std; namespace marcelb { #ifndef ON_RUNNER #define ON_RUNNER runner on_async; #endif /** * Run the function asynchronously */ template auto asynco(F&& f, Args&&... args) -> future::type> { using return_type = typename result_of::type; future res = on_async.put_task(bind(forward(f), forward(args)...)); return res; } /** * Block until the asynchronous call completes */ template T wait(future r) { return r.get(); } } #endif