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