From f049cbb68494e9fb0fe0b5b9567e05a70aa141d4 Mon Sep 17 00:00:00 2001 From: MarcoFalke Date: Fri, 21 Feb 2020 09:48:27 -0800 Subject: [PATCH] util: Remove unused MilliSleep Cherry-picked from: fae86c38bca5c960462e53975314a0749db5d17d --- src/test/scheduler_tests.cpp | 12 ++++-------- src/utiltime.h | 7 ------- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/src/test/scheduler_tests.cpp b/src/test/scheduler_tests.cpp index 231ad359d85..553b3b3f71a 100644 --- a/src/test/scheduler_tests.cpp +++ b/src/test/scheduler_tests.cpp @@ -3,8 +3,9 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include "random.h" -#include "scheduler.h" +#include +#include +#include #include "test/test_bitcoin.h" @@ -27,11 +28,6 @@ static void microTask(CScheduler& s, boost::mutex& mutex, int& counter, int delt } } -static void MicroSleep(uint64_t n) -{ - boost::this_thread::sleep_for(boost::chrono::microseconds(n)); -} - BOOST_AUTO_TEST_CASE(manythreads) { // Stress test: hundreds of microsecond-scheduled tasks, @@ -78,7 +74,7 @@ BOOST_AUTO_TEST_CASE(manythreads) for (int i = 0; i < 5; i++) microThreads.create_thread(boost::bind(&CScheduler::serviceQueue, µTasks)); - MicroSleep(600); + UninterruptibleSleep(std::chrono::microseconds{600}); now = boost::chrono::system_clock::now(); // More threads and more tasks: diff --git a/src/utiltime.h b/src/utiltime.h index 5db9abb024b..d4d2fac9716 100644 --- a/src/utiltime.h +++ b/src/utiltime.h @@ -39,8 +39,6 @@ void SetMockTime(int64_t nMockTimeIn); /** For testing */ int64_t GetMockTime(); -void MilliSleep(int64_t n); - /** * GetTimeMicros() and GetTimeMillis() both return the system time, but in * different units. GetTime() returns the system time in seconds, but also @@ -53,11 +51,6 @@ void MilliSleep(int64_t n); int64_t GetLogTimeMicros(); int64_t GetMockableTimeMicros(); -/** For testing. Set e.g. with the setmocktime rpc, or -mocktime argument */ -void SetMockTime(int64_t nMockTimeIn); -/** For testing */ -int64_t GetMockTime(); - /** Return system time (or mocked time, if set) */ template T GetTime();