| 45 | // An improved async, that doesn't block |
| 46 | template <class Function> |
| 47 | static std::future<std::invoke_result_t<Function>> detach_async(Function&& f, bool parallel = true) |
| 48 | { |
| 49 | if(parallel) |
| 50 | { |
| 51 | using result_type = typename std::invoke_result<Function>::type; |
| 52 | std::packaged_task<result_type()> task(std::forward<Function>(f)); |
| 53 | auto fut = task.get_future(); |
| 54 | std::thread(std::move(task)).detach(); |
| 55 | return fut; |
| 56 | } |
| 57 | return std::async(std::launch::deferred, std::forward<Function>(f)); |
| 58 | } |
| 59 | |
| 60 | inline static void verify_load_save(const migraphx::program& p) |
| 61 | { |