From 1d94cbc6ce1173eb2dbd0133aa68c99d9484002e Mon Sep 17 00:00:00 2001 From: Hartmut Kaiser Date: Thu, 23 Jan 2025 09:32:51 -0600 Subject: [PATCH] Cleaning up copy_component facility --- .../runtime_distributed/copy_component.hpp | 13 ++++------ .../server/copy_component.hpp | 24 +++++++++---------- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/libs/full/runtime_distributed/include/hpx/runtime_distributed/copy_component.hpp b/libs/full/runtime_distributed/include/hpx/runtime_distributed/copy_component.hpp index 569309729621..61114eb2d562 100644 --- a/libs/full/runtime_distributed/include/hpx/runtime_distributed/copy_component.hpp +++ b/libs/full/runtime_distributed/include/hpx/runtime_distributed/copy_component.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2021 Hartmut Kaiser +// Copyright (c) 2007-2025 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -19,7 +19,7 @@ #include -namespace hpx { namespace components { +namespace hpx::components { /// \brief Copy given component to the specified target locality /// @@ -43,8 +43,7 @@ namespace hpx { namespace components { #if defined(DOXYGEN) future #else - inline typename std::enable_if::value, - future>::type + std::enable_if_t, future> #endif copy(hpx::id_type const& to_copy) { @@ -73,8 +72,7 @@ namespace hpx { namespace components { #if defined(DOXYGEN) future #else - inline typename std::enable_if::value, - future>::type + std::enable_if_t, future> #endif copy(hpx::id_type const& to_copy, hpx::id_type const& target_locality) { @@ -115,8 +113,7 @@ namespace hpx { namespace components { typename client_base::server_component_type; using action_type = server::copy_component_action; - id_type id = to_copy.get_id(); return Derived(hpx::detail::async_colocated( to_copy, to_copy, target_locality)); } -}} // namespace hpx::components +} // namespace hpx::components diff --git a/libs/full/runtime_distributed/include/hpx/runtime_distributed/server/copy_component.hpp b/libs/full/runtime_distributed/include/hpx/runtime_distributed/server/copy_component.hpp index f59d1ab30497..349f82a575c4 100644 --- a/libs/full/runtime_distributed/include/hpx/runtime_distributed/server/copy_component.hpp +++ b/libs/full/runtime_distributed/include/hpx/runtime_distributed/server/copy_component.hpp @@ -1,4 +1,4 @@ -// Copyright (c) 2007-2021 Hartmut Kaiser +// Copyright (c) 2007-2025 Hartmut Kaiser // // SPDX-License-Identifier: BSL-1.0 // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -16,7 +16,7 @@ #include -namespace hpx { namespace components { namespace server { +namespace hpx::components::server { /////////////////////////////////////////////////////////////////////////// /// \brief Copy given component to the specified target locality @@ -49,8 +49,10 @@ namespace hpx { namespace components { namespace server { hpx::components::server::runtime_support* rts = hpx::get_runtime_support_ptr(); + // clang-format off return traits::get_remote_result:: call(rts->copy_create_component(ptr, true)); + // clang-format on } return runtime_support::copy_create_component( @@ -60,13 +62,11 @@ namespace hpx { namespace components { namespace server { /////////////////////////////////////////////////////////////////////////// template - future copy_component_here(hpx::id_type const& to_copy) + hpx::id_type copy_component_here(hpx::id_type const& to_copy) { - future> f = get_ptr(to_copy); - return f.then( - [=](future> f) -> hpx::id_type { - return detail::copy_component_here_postproc(f.get()); - }); + std::shared_ptr sp = + get_ptr(hpx::launch::sync, to_copy); + return detail::copy_component_here_postproc(HPX_MOVE(sp)); } template @@ -75,15 +75,15 @@ namespace hpx { namespace components { namespace server { { future> f = get_ptr(to_copy); return f.then( - [=](future> f) -> hpx::id_type { + [=](future>&& fsp) -> hpx::id_type { return detail::copy_component_postproc( - f.get(), target_locality); + fsp.get(), target_locality); }); } template struct copy_component_action_here - : ::hpx::actions::action (*)(hpx::id_type const&), + : ::hpx::actions::action, copy_component_action_here> { @@ -96,4 +96,4 @@ namespace hpx { namespace components { namespace server { ©_component, copy_component_action> { }; -}}} // namespace hpx::components::server +} // namespace hpx::components::server