Skip to content

Commit

Permalink
test: Replace boost::mutex with std::mutex
Browse files Browse the repository at this point in the history
  • Loading branch information
hebasto committed Apr 17, 2020
1 parent 895c71e commit 27abd1a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/test/scheduler_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
#include <boost/test/unit_test.hpp>
#include <boost/thread.hpp>

#include <mutex>

BOOST_AUTO_TEST_SUITE(scheduler_tests)

static void microTask(CScheduler& s, boost::mutex& mutex, int& counter, int delta, std::chrono::system_clock::time_point rescheduleTime)
static void microTask(CScheduler& s, std::mutex& mutex, int& counter, int delta, std::chrono::system_clock::time_point rescheduleTime)
{
{
boost::unique_lock<boost::mutex> lock(mutex);
std::lock_guard<std::mutex> lock(mutex);
counter += delta;
}
std::chrono::system_clock::time_point noTime = std::chrono::system_clock::time_point::min();
Expand All @@ -38,7 +40,7 @@ BOOST_AUTO_TEST_CASE(manythreads)
// counters should sum to the number of initial tasks performed.
CScheduler microTasks;

boost::mutex counterMutex[10];
std::mutex counterMutex[10];
int counter[10] = { 0 };
FastRandomContext rng{/* fDeterministic */ true};
auto zeroToNine = [](FastRandomContext& rc) -> int { return rc.randrange(10); }; // [0, 9]
Expand Down

0 comments on commit 27abd1a

Please sign in to comment.