Skip to content

Commit

Permalink
util: Remove unused MilliSleep
Browse files Browse the repository at this point in the history
Cherry-picked from: fae86c3
  • Loading branch information
MarcoFalke authored and xanimo committed Mar 30, 2024
1 parent fa541d1 commit db8d68d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 23 deletions.
12 changes: 4 additions & 8 deletions src/test/scheduler_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 <random.h>
#include <scheduler.h>
#include <utiltime.h>

#include "test/test_bitcoin.h"

Expand All @@ -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,
Expand Down Expand Up @@ -78,7 +74,7 @@ BOOST_AUTO_TEST_CASE(manythreads)
for (int i = 0; i < 5; i++)
microThreads.create_thread(boost::bind(&CScheduler::serviceQueue, &microTasks));

MicroSleep(600);
UninterruptibleSleep(std::chrono::microseconds{600});
now = boost::chrono::system_clock::now();

// More threads and more tasks:
Expand Down
6 changes: 0 additions & 6 deletions src/utiltime.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

#include <atomic>
#include <boost/date_time/posix_time/posix_time.hpp>
#include <boost/thread.hpp>
#include <ctime>
#include <chrono>
#include <thread>
Expand Down Expand Up @@ -93,11 +92,6 @@ int64_t GetLogTimeMicros()
return GetTimeMicros();
}

void MilliSleep(int64_t n)
{
boost::this_thread::sleep_for(boost::chrono::milliseconds(n));
}

std::string DateTimeStrFormat(const char* pszFormat, int64_t nTime)
{
static std::locale classic(std::locale::classic());
Expand Down
9 changes: 0 additions & 9 deletions src/utiltime.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,6 @@ int64_t GetTimeMicros();
/** Returns the system time (not mockable) */
int64_t GetSystemTimeInSeconds(); // Like GetTime(), but not mockable

/** For testing. Set e.g. with the setmocktime rpc, or -mocktime argument */
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
Expand All @@ -58,8 +51,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();
Expand Down

0 comments on commit db8d68d

Please sign in to comment.