diff --git a/include/ircd/ctx/async.h b/include/ircd/ctx/async.h index 7f8c8404d..cd88c6167 100644 --- a/include/ircd/ctx/async.h +++ b/include/ircd/ctx/async.h @@ -38,7 +38,7 @@ namespace ircd::ctx future::type>>::type; template future_value async(F&& f, A&&... a); diff --git a/include/ircd/ctx/pool.h b/include/ircd/ctx/pool.h index ee6cbed54..9be9acaa5 100644 --- a/include/ircd/ctx/pool.h +++ b/include/ircd/ctx/pool.h @@ -90,18 +90,15 @@ ircd::ctx::pool::async(F&& f, std::bind(std::forward(f), std::forward(a)...) }; - auto p - { - std::make_shared>() - }; - - (*this)([p, func(std::move(func))] + promise p; + future ret{p}; + (*this)([p(std::move(p)), func(std::move(func))] () -> void { - p->set_value(func()); + p.set_value(func()); }); - return future(*p); + return ret; } template(f), std::forward(a)...) }; - auto p - { - std::make_shared>() - }; - - (*this)([p, func(std::move(func))] + promise p; + future ret{p}; + (*this)([p(std::move(p)), func(std::move(func))] () -> void { func(); - p->set_value(); + p.set_value(); }); - return future(*p); + return ret; }