Skip to content

Commit

Permalink
fixed error in test
Browse files Browse the repository at this point in the history
  • Loading branch information
Johan511 committed Feb 8, 2024
1 parent 8088e54 commit 176937c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 <typename Lock, typename RangeEndGen, typename CriticalSection>
template <typename RangeMutex, typename RangeEndGen,
typename CriticalSection>
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)
Expand All @@ -88,7 +89,7 @@ namespace hpx::ranged_lock::test::util {
get_increment_ranges(num_incr_per_thread * num_threads, len,
std::forward<RangeEndGen>(range_end_gen));

Lock bl;
RangeMutex rmtx;

for (std::size_t i = 0; i != num_threads; i++)
{
Expand All @@ -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);
}
});
}
Expand Down

0 comments on commit 176937c

Please sign in to comment.