mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-08 10:31:50 -05:00
Merge #18695: test: Replace boost::mutex with std::mutex
27abd1a4f4
test: Replace boost::mutex with std::mutex (Hennadii Stepanov) Pull request description: This PR replaces `boost::mutex` with `std::mutex` in the `scheduler_tests` test suite. ACKs for top commit: theStack: ACK27abd1a4f4
sipa: utACK27abd1a4f4
Tree-SHA512: 062eed360a68910fb71552fd892bfd097442718a237446cfb8350bfd5d807da7251ead2b9755e1d7022598774ed23fa5432a589ac6f8cadddab404b439883466
This commit is contained in:
commit
d65631171c
1 changed files with 5 additions and 3 deletions
|
@ -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();
|
||||
|
@ -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]
|
||||
|
|
Loading…
Add table
Reference in a new issue