Skip to content

Commit

Permalink
Minor changes to how actions are executed. This mostly improves consi…
Browse files Browse the repository at this point in the history
…stency of different APIs.
  • Loading branch information
hkaiser committed Feb 5, 2018
1 parent f910b98 commit 0405dc8
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 15 deletions.
12 changes: 6 additions & 6 deletions hpx/lcos/async.hpp
Expand Up @@ -21,7 +21,7 @@
#include <hpx/traits/is_valid_action.hpp>
#include <hpx/traits/promise_local_result.hpp>
#include <hpx/util/assert.hpp>
#include <hpx/util/bind.hpp>
#include <hpx/util/deferred_call.hpp>

#include <type_traits>
#include <utility>
Expand All @@ -46,7 +46,7 @@ namespace hpx { namespace detail
>
>::type
operator()(Policy const& launch_policy,
components::client_base<Client, Stub> const& c, Ts &&... ts) const
components::client_base<Client, Stub> && c, Ts &&... ts) const
{
HPX_ASSERT(c.is_ready());
return hpx::detail::async_impl<Action>(launch_policy, c.get_id(),
Expand Down Expand Up @@ -107,10 +107,10 @@ namespace hpx { namespace detail
}

// defer invocation otherwise
return c.then(util::bind(
util::one_shot(async_action_client_dispatch<Action>()),
std::forward<Policy_>(launch_policy), c, std::forward<Ts>(ts)...
));
return c.then(util::deferred_call(
async_action_client_dispatch<Action>(),
std::forward<Policy_>(launch_policy), std::move(c),
std::forward<Ts>(ts)...));
}

// distribution policy
Expand Down
22 changes: 13 additions & 9 deletions hpx/runtime/actions/basic_action.hpp
Expand Up @@ -195,6 +195,7 @@ namespace hpx { namespace actions
std::is_void<R>::value, util::unused_type, R
>::type
result_type;

template <typename ...Ts>
HPX_FORCEINLINE result_type operator()(
naming::address::address_type lva,
Expand All @@ -205,6 +206,7 @@ namespace hpx { namespace actions
std::forward<Ts>(vs)...);
}

private:
template <typename ...Ts>
HPX_FORCEINLINE result_type invoke(std::true_type,
naming::address::address_type lva,
Expand Down Expand Up @@ -291,7 +293,8 @@ namespace hpx { namespace actions
naming::address::address_type lva,
naming::address::component_type comptype, Ts&&... vs)
{
if (target && target.get_management_type() == naming::id_type::unmanaged)
if (target &&
target.get_management_type() == naming::id_type::unmanaged)
{
return traits::action_decorate_function<Derived>::call(lva,
util::bind(util::one_shot(
Expand Down Expand Up @@ -322,7 +325,8 @@ namespace hpx { namespace actions
naming::address::component_type&, Ts&&...
> thread_function;

if (target && target.get_management_type() == naming::id_type::unmanaged)
if (target &&
target.get_management_type() == naming::id_type::unmanaged)
{
return traits::action_decorate_function<Derived>::call(lva,
thread_function(std::move(cont), lva, invoker(),
Expand Down Expand Up @@ -388,7 +392,7 @@ namespace hpx { namespace actions
Ts&&... vs) const
{
return sync_invoke::call(
launch::sync, id, throws, std::forward<Ts>(vs)...);
policy, id, throws, std::forward<Ts>(vs)...);
}

template <typename ...Ts>
Expand Down Expand Up @@ -422,8 +426,8 @@ namespace hpx { namespace actions
operator()(DistPolicy const& dist_policy, error_code& ec,
Ts&&... vs) const
{
return (*this)(launch::sync, dist_policy, ec,
std::forward<Ts>(vs)...);
return sync_invoke::call(
launch::sync, dist_policy, ec, std::forward<Ts>(vs)...);
}

template <typename DistPolicy, typename ...Ts>
Expand All @@ -435,8 +439,8 @@ namespace hpx { namespace actions
operator()(launch policy,
DistPolicy const& dist_policy, Ts&&... vs) const
{
return (*this)(launch::sync, dist_policy, throws,
std::forward<Ts>(vs)...);
return sync_invoke::call(
launch, dist_policy, throws, std::forward<Ts>(vs)...);
}

template <typename DistPolicy, typename ...Ts>
Expand All @@ -447,8 +451,8 @@ namespace hpx { namespace actions
>::type
operator()(DistPolicy const& dist_policy, Ts&&... vs) const
{
return (*this)(launch::sync, dist_policy, throws,
std::forward<Ts>(vs)...);
return sync_invoke::call(
launch::sync, dist_policy, throws, std::forward<Ts>(vs)...);
}

///////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit 0405dc8

Please sign in to comment.