diff --git a/job/dispatch.hpp b/job/dispatch.hpp index ccd1cb0a..1d8b39b6 100644 --- a/job/dispatch.hpp +++ b/job/dispatch.hpp @@ -30,7 +30,9 @@ namespace util::job { // // threads will have work sizes dictated by a supplied extent. // - // returns a cookie, or container of cookies, to wait on. + // returns a cookie that will block at destruction until all jobs have + // completed. it will take ownership of an forwarding-reference function + // if one is supplied. // // TODO: extend to 1d and 3d template < @@ -39,12 +41,12 @@ namespace util::job { typename ...Args, size_t DimensionV > - std::vector + auto dispatch ( util::job::queue &q, ContainerT &data, util::extent chunk, - FunctionT &func, + FunctionT &&func, Args ...args) { auto chunked_func = [&func] (ContainerT &inner_data, @@ -74,7 +76,7 @@ namespace util::job { ); } - return cookies; + return std::tuple (std::forward (func), std::move (cookies)); } }