static lcos::future<Result> call(naming::id_type const& id, naming::address && addr, Ts &&... vs) { bool target_is_managed = false; naming::id_type id1; if (id.get_management_type() == naming::id_type::managed) { id1 = naming::id_type(id.get_gid(), naming::id_type::unmanaged); target_is_managed = true; } lcos::packaged_action<Action, Result> p; p.apply(std::move(addr), target_is_managed ? id1 : id, std::forward<Ts>(vs)...); // keep id alive, if needed - this allows to send the destination // as an unmanaged id future<Result> f = p.get_future(); if (target_is_managed) { typedef typename traits::detail::shared_state_ptr_for< future<Result> >::type shared_state_ptr; shared_state_ptr const& state = traits::detail::get_shared_state(f); state->set_on_completed(hpx::detail::keep_id_alive(id)); } return f; }
void trigger_lco_event(naming::id_type const& id, naming::address && addr, naming::id_type const& cont, bool move_credits) { typedef lcos::base_lco::set_event_action set_action; typedef hpx::traits::extract_action<set_action>::local_result_type local_result_type; typedef hpx::traits::extract_action<set_action>::remote_result_type remote_result_type; if (move_credits && id.get_management_type() != naming::id_type::unmanaged) { naming::id_type target(id.get_gid(), id_type::managed_move_credit); id.make_unmanaged(); detail::apply_impl<set_action>( actions::typed_continuation< local_result_type, remote_result_type>(cont), target, std::move(addr), actions::action_priority<set_action>()); } else { detail::apply_impl<set_action>( actions::typed_continuation< local_result_type, remote_result_type>(cont), id, std::move(addr), actions::action_priority<set_action>()); } }
void set_lco_error(naming::id_type const& id, naming::address && addr, std::exception_ptr const& e, bool move_credits) { typedef lcos::base_lco::set_exception_action set_action; if (move_credits && id.get_management_type() != naming::id_type::unmanaged) { naming::id_type target(id.get_gid(), id_type::managed_move_credit); id.make_unmanaged(); detail::apply_impl<set_action>( target, std::move(addr), actions::action_priority<set_action>(), e); } else { detail::apply_impl<set_action>( id, std::move(addr), actions::action_priority<set_action>(), e); } }