mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 06:28:31 +01:00
scripted-diff: Replace boost::bind with std::bind
-BEGIN VERIFY SCRIPT-
for j in $(seq 1 5)
do
sed -i "s/ _${j}/ std::placeholders::_${j}/g" $(git grep --name-only " _${j}" -- '*.cpp' '*.h')
done
sed -i "s/boost::bind/std::bind/g" $(git grep --name-only boost::bind -- '*.cpp' '*.h')
sed -i "s/boost::ref/std::ref/g" $(git grep --name-only boost::ref -- '*.cpp' '*.h')
sed -i '/boost\/bind/d' $(git grep --name-only boost/bind)
-END VERIFY SCRIPT-
This commit is contained in:
@@ -7,7 +7,6 @@
|
||||
|
||||
#include <test/test_bitcoin.h>
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/thread.hpp>
|
||||
#include <boost/test/unit_test.hpp>
|
||||
|
||||
@@ -21,7 +20,7 @@ static void microTask(CScheduler& s, boost::mutex& mutex, int& counter, int delt
|
||||
}
|
||||
boost::chrono::system_clock::time_point noTime = boost::chrono::system_clock::time_point::min();
|
||||
if (rescheduleTime != noTime) {
|
||||
CScheduler::Function f = boost::bind(µTask, boost::ref(s), boost::ref(mutex), boost::ref(counter), -delta + 1, noTime);
|
||||
CScheduler::Function f = std::bind(µTask, std::ref(s), std::ref(mutex), std::ref(counter), -delta + 1, noTime);
|
||||
s.schedule(f, rescheduleTime);
|
||||
}
|
||||
}
|
||||
@@ -69,8 +68,8 @@ BOOST_AUTO_TEST_CASE(manythreads)
|
||||
boost::chrono::system_clock::time_point t = now + boost::chrono::microseconds(randomMsec(rng));
|
||||
boost::chrono::system_clock::time_point tReschedule = now + boost::chrono::microseconds(500 + randomMsec(rng));
|
||||
int whichCounter = zeroToNine(rng);
|
||||
CScheduler::Function f = boost::bind(µTask, boost::ref(microTasks),
|
||||
boost::ref(counterMutex[whichCounter]), boost::ref(counter[whichCounter]),
|
||||
CScheduler::Function f = std::bind(µTask, std::ref(microTasks),
|
||||
std::ref(counterMutex[whichCounter]), std::ref(counter[whichCounter]),
|
||||
randomDelta(rng), tReschedule);
|
||||
microTasks.schedule(f, t);
|
||||
}
|
||||
@@ -82,20 +81,20 @@ BOOST_AUTO_TEST_CASE(manythreads)
|
||||
// As soon as these are created they will start running and servicing the queue
|
||||
boost::thread_group microThreads;
|
||||
for (int i = 0; i < 5; i++)
|
||||
microThreads.create_thread(boost::bind(&CScheduler::serviceQueue, µTasks));
|
||||
microThreads.create_thread(std::bind(&CScheduler::serviceQueue, µTasks));
|
||||
|
||||
MicroSleep(600);
|
||||
now = boost::chrono::system_clock::now();
|
||||
|
||||
// More threads and more tasks:
|
||||
for (int i = 0; i < 5; i++)
|
||||
microThreads.create_thread(boost::bind(&CScheduler::serviceQueue, µTasks));
|
||||
microThreads.create_thread(std::bind(&CScheduler::serviceQueue, µTasks));
|
||||
for (int i = 0; i < 100; i++) {
|
||||
boost::chrono::system_clock::time_point t = now + boost::chrono::microseconds(randomMsec(rng));
|
||||
boost::chrono::system_clock::time_point tReschedule = now + boost::chrono::microseconds(500 + randomMsec(rng));
|
||||
int whichCounter = zeroToNine(rng);
|
||||
CScheduler::Function f = boost::bind(µTask, boost::ref(microTasks),
|
||||
boost::ref(counterMutex[whichCounter]), boost::ref(counter[whichCounter]),
|
||||
CScheduler::Function f = std::bind(µTask, std::ref(microTasks),
|
||||
std::ref(counterMutex[whichCounter]), std::ref(counter[whichCounter]),
|
||||
randomDelta(rng), tReschedule);
|
||||
microTasks.schedule(f, t);
|
||||
}
|
||||
@@ -126,7 +125,7 @@ BOOST_AUTO_TEST_CASE(singlethreadedscheduler_ordered)
|
||||
// if they don't we'll get out of order behaviour
|
||||
boost::thread_group threads;
|
||||
for (int i = 0; i < 5; ++i) {
|
||||
threads.create_thread(boost::bind(&CScheduler::serviceQueue, &scheduler));
|
||||
threads.create_thread(std::bind(&CScheduler::serviceQueue, &scheduler));
|
||||
}
|
||||
|
||||
// these are not atomic, if SinglethreadedSchedulerClient prevents
|
||||
|
||||
Reference in New Issue
Block a user