From d06c9ad13aca0ed38e77e08fa2664290389fbc4e Mon Sep 17 00:00:00 2001 From: isidorostsa Date: Wed, 14 Aug 2024 10:30:25 +0300 Subject: [PATCH] Make async_rw_mutex test use let_value instead of then + sync_wait --- .../include/hpx/synchronization/async_rw_mutex.hpp | 2 +- libs/core/synchronization/tests/unit/async_rw_mutex.cpp | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/libs/core/synchronization/include/hpx/synchronization/async_rw_mutex.hpp b/libs/core/synchronization/include/hpx/synchronization/async_rw_mutex.hpp index 07119647520..06814a8e3f1 100644 --- a/libs/core/synchronization/include/hpx/synchronization/async_rw_mutex.hpp +++ b/libs/core/synchronization/include/hpx/synchronization/async_rw_mutex.hpp @@ -444,7 +444,7 @@ namespace hpx::experimental { template friend auto tag_invoke( hpx::execution::experimental::get_completion_signatures_t, - sender const&, Env) + sender const&, Env const&) -> hpx::execution::experimental::completion_signatures< hpx::execution::experimental::set_value_t(access_type), hpx::execution::experimental::set_error_t( diff --git a/libs/core/synchronization/tests/unit/async_rw_mutex.cpp b/libs/core/synchronization/tests/unit/async_rw_mutex.cpp index 6c91426b517..7999e8ae88c 100644 --- a/libs/core/synchronization/tests/unit/async_rw_mutex.cpp +++ b/libs/core/synchronization/tests/unit/async_rw_mutex.cpp @@ -158,9 +158,18 @@ void submit_senders(Executor&& exec, Senders& senders) { for (auto& sender : senders) { +// Original code uses sync_wait inside an hpx scheduler. Sync_wait completely +// blocks the thread with std synchronization primitives which causes it to hang +#ifdef HPX_HAVE_STDEXEC + hpx::execution::experimental::start_detached( + hpx::execution::experimental::schedule(exec) | + hpx::execution::experimental::let_value( + [s = std::move(sender)]() mutable { return std::move(s); })); +#else execute(exec, [sender = std::move(sender)]() mutable { sync_wait(std::move(sender)); }); +#endif } }