Skip to content

Commit

Permalink
fixing incorrect std::system_error syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan511 committed Dec 8, 2023
1 parent 67cffc3 commit e0f8f33
Showing 1 changed file with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include <cstddef>
#include <functional>
#include <mutex>
#include <system_error>
#include <utility>

namespace hpx::synchronization {
Expand Down Expand Up @@ -98,21 +99,21 @@ namespace hpx::synchronization {
void lock(std::size_t begin, std::size_t end)
{
if (lock_id != 0)
throw std::system_error(std::errc::operation_not_permitted);
throw std::system_error(
std::errc::EDEADLK, "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::errc::operation_not_permitted);
throw std::system_error(
std::errc::EDEADLK, "unique_lock::lock: already locked");
lock_id = mutex_ref.get().try_lock(begin, end);
}

void unlock()
{
if (lock_id != 0)
throw std::system_error(std::errc::operation_not_permitted);
mutex_ref.get().unlock(lock_id);
lock_id = 0;
}
Expand Down

0 comments on commit e0f8f33

Please sign in to comment.