diff --git a/libs/core/synchronization/include/hpx/synchronization/range_mutex.hpp b/libs/core/synchronization/include/hpx/synchronization/range_mutex.hpp index 34edd49af437..be79509e7fcf 100644 --- a/libs/core/synchronization/include/hpx/synchronization/range_mutex.hpp +++ b/libs/core/synchronization/include/hpx/synchronization/range_mutex.hpp @@ -44,9 +44,9 @@ namespace hpx::synchronization { range_guard& operator=(range_guard const&) = delete; range_guard(range_guard&& rhs_lock) + : lock_id(rhs_lock.lock_id) + , mutex_ref(rhs_lock.mutex_ref) { - mutex_ref = rhs_lock.mutex_ref; - lock_id = rhs_lock.lock_id; rhs_lock.lock_id = 0; } @@ -81,9 +81,9 @@ namespace hpx::synchronization { range_unique_lock& operator=(range_unique_lock const&) = delete; range_unique_lock(range_unique_lock&& rhs_lock) + : mutex_ref(rhs_lock.mutex_ref) + , lock_id(rhs_lock.lock_id) { - mutex_ref = rhs_lock.mutex_ref; - lock_id = rhs_lock.lock_id; rhs_lock.lock_id = 0; } diff --git a/libs/core/synchronization/tests/unit/range_mutex/range_mutex.cpp b/libs/core/synchronization/tests/unit/range_mutex/range_mutex.cpp index 302fc75dc192..119af89ea5ab 100644 --- a/libs/core/synchronization/tests/unit/range_mutex/range_mutex.cpp +++ b/libs/core/synchronization/tests/unit/range_mutex/range_mutex.cpp @@ -19,7 +19,6 @@ int main() hpx::synchronization::range_mutex rm; hpx::synchronization::range_unique_lock lg(rm, 1, 2); - lg.lock(3, 4); hpx::ranged_lock::test::util::test_lock_n_times< hpx::synchronization::range_mutex>( 10, 1'00'000, 4, 100,