diff --git a/libs/core/synchronization/include/hpx/synchronization/range_mutex.hpp b/libs/core/synchronization/include/hpx/synchronization/range_mutex.hpp index eef1a102829..095bdd052d7 100644 --- a/libs/core/synchronization/include/hpx/synchronization/range_mutex.hpp +++ b/libs/core/synchronization/include/hpx/synchronization/range_mutex.hpp @@ -99,16 +99,24 @@ namespace hpx::synchronization { void lock(std::size_t begin, std::size_t end) { if (lock_id != 0) - throw std::system_error(std::error_code(EDEADLK), - "unique_lock::lock: already locked"); + { + std::error_code ec = std::make_error_code( + std::errc::resource_deadlock_would_occur); + throw std::system_error( + ec, "unique_lock::lock: already locked"); + } lock_id = mutex_ref.get().lock(begin, end); } void try_lock(std::size_t begin, std::size_t end) { if (lock_id != 0) - throw std::system_error(std::error_code(EDEADLK), - "unique_lock::lock: already locked"); + { + std::error_code ec = std::make_error_code( + std::errc::resource_deadlock_would_occur); + throw std::system_error( + ec, "unique_lock::lock: already locked"); + } lock_id = mutex_ref.get().try_lock(begin, end); }