From 2c87d1b8642b47b21713b30056133b914f1408d8 Mon Sep 17 00:00:00 2001 From: Hari Hara Naveen S Date: Wed, 7 Feb 2024 09:04:03 -0600 Subject: [PATCH] fixed error in test --- .../include/hpx/synchronization/range_mutex.hpp | 4 ++-- .../tests/unit/range_mutex/range_mutex_util.hpp | 11 ++++++----- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/libs/core/synchronization/include/hpx/synchronization/range_mutex.hpp b/libs/core/synchronization/include/hpx/synchronization/range_mutex.hpp index be79509e7fcf..70c77fa12259 100644 --- a/libs/core/synchronization/include/hpx/synchronization/range_mutex.hpp +++ b/libs/core/synchronization/include/hpx/synchronization/range_mutex.hpp @@ -103,7 +103,7 @@ namespace hpx::synchronization { std::error_code ec = std::make_error_code( std::errc::resource_deadlock_would_occur); throw std::system_error( - ec, "unique_lock::lock: already locked"); + ec, "range_unique_lock::lock: already locked"); } lock_id = mutex_ref.get().lock(begin, end); } @@ -115,7 +115,7 @@ namespace hpx::synchronization { std::error_code ec = std::make_error_code( std::errc::resource_deadlock_would_occur); throw std::system_error( - ec, "unique_lock::lock: already locked"); + ec, "range_unique_lock::lock: already locked"); } lock_id = mutex_ref.get().try_lock(begin, end); } diff --git a/libs/core/synchronization/tests/unit/range_mutex/range_mutex_util.hpp b/libs/core/synchronization/tests/unit/range_mutex/range_mutex_util.hpp index 08d2003b7497..3d51ceff8c2c 100644 --- a/libs/core/synchronization/tests/unit/range_mutex/range_mutex_util.hpp +++ b/libs/core/synchronization/tests/unit/range_mutex/range_mutex_util.hpp @@ -76,7 +76,8 @@ namespace hpx::ranged_lock::test::util { NOTE : Critical Section should take care of obtaining the lock passed as first parameter */ - template + template void test_lock_once(std::size_t const len, std::size_t const num_threads, std::size_t const num_incr_per_thread, RangeEndGen&& range_end_gen, CriticalSection&& critical_section) @@ -88,7 +89,7 @@ namespace hpx::ranged_lock::test::util { get_increment_ranges(num_incr_per_thread * num_threads, len, std::forward(range_end_gen)); - Lock bl; + RangeMutex rmtx; for (std::size_t i = 0; i != num_threads; i++) { @@ -99,18 +100,18 @@ namespace hpx::ranged_lock::test::util { increments.begin() + ((i + 1) * num_incr_per_thread); threads.emplace_back( - [&bl, &v, &critical_section, start_iter, end_iter]() { + [&rmtx, &v, &critical_section, start_iter, end_iter]() { increments_ty::iterator it = start_iter; for (; it != end_iter; ++it) { std::size_t begin = it->first; std::size_t end = it->second; - std::size_t lockId = bl.lock(begin, end); + std::size_t lockId = rmtx.lock(begin, end); critical_section(v, begin, end); - bl.unlock(lockId); + rmtx.unlock(lockId); } }); }