diff options
author | MarcoFalke <falke.marco@gmail.com> | 2020-02-21 09:48:27 -0800 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2020-02-21 10:06:27 -0800 |
commit | fae86c38bca5c960462e53975314a0749db5d17d (patch) | |
tree | ab37c90ad339526d73e7680091bb28967c90a74a /src | |
parent | fa9af06d91e9357e86863781746f0e78a509967e (diff) | |
download | bitcoin-fae86c38bca5c960462e53975314a0749db5d17d.tar.xz |
util: Remove unused MilliSleep
Diffstat (limited to 'src')
-rw-r--r-- | src/test/scheduler_tests.cpp | 15 | ||||
-rw-r--r-- | src/util/time.cpp | 19 | ||||
-rw-r--r-- | src/util/time.h | 2 |
3 files changed, 2 insertions, 34 deletions
diff --git a/src/test/scheduler_tests.cpp b/src/test/scheduler_tests.cpp index a6cb34cf28..058dd1deda 100644 --- a/src/test/scheduler_tests.cpp +++ b/src/test/scheduler_tests.cpp @@ -4,6 +4,7 @@ #include <random.h> #include <scheduler.h> +#include <util/time.h> #include <boost/thread.hpp> #include <boost/test/unit_test.hpp> @@ -23,18 +24,6 @@ static void microTask(CScheduler& s, boost::mutex& mutex, int& counter, int delt } } -static void MicroSleep(uint64_t n) -{ -#if defined(HAVE_WORKING_BOOST_SLEEP_FOR) - boost::this_thread::sleep_for(boost::chrono::microseconds(n)); -#elif defined(HAVE_WORKING_BOOST_SLEEP) - boost::this_thread::sleep(boost::posix_time::microseconds(n)); -#else - //should never get here - #error missing boost sleep implementation -#endif -} - BOOST_AUTO_TEST_CASE(manythreads) { // Stress test: hundreds of microsecond-scheduled tasks, @@ -81,7 +70,7 @@ BOOST_AUTO_TEST_CASE(manythreads) for (int i = 0; i < 5; i++) microThreads.create_thread(std::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/util/time.cpp b/src/util/time.cpp index 5c1182850e..f6d0dd4da6 100644 --- a/src/util/time.cpp +++ b/src/util/time.cpp @@ -11,7 +11,6 @@ #include <atomic> #include <boost/date_time/posix_time/posix_time.hpp> -#include <boost/thread.hpp> #include <ctime> #include <thread> @@ -76,24 +75,6 @@ int64_t GetSystemTimeInSeconds() return GetTimeMicros()/1000000; } -void MilliSleep(int64_t n) -{ - -/** - * Boost's sleep_for was uninterruptible when backed by nanosleep from 1.50 - * until fixed in 1.52. Use the deprecated sleep method for the broken case. - * See: https://svn.boost.org/trac/boost/ticket/7238 - */ -#if defined(HAVE_WORKING_BOOST_SLEEP_FOR) - boost::this_thread::sleep_for(boost::chrono::milliseconds(n)); -#elif defined(HAVE_WORKING_BOOST_SLEEP) - boost::this_thread::sleep(boost::posix_time::milliseconds(n)); -#else -//should never get here -#error missing boost sleep implementation -#endif -} - std::string FormatISO8601DateTime(int64_t nTime) { struct tm ts; time_t time_val = nTime; diff --git a/src/util/time.h b/src/util/time.h index 445ca3acb3..77de1e047d 100644 --- a/src/util/time.h +++ b/src/util/time.h @@ -38,8 +38,6 @@ void SetMockTime(int64_t nMockTimeIn); /** For testing */ int64_t GetMockTime(); -void MilliSleep(int64_t n); - /** Return system time (or mocked time, if set) */ template <typename T> T GetTime(); |