Skip to content

Commit 004c064

Browse files
MarcoFalkerandom-zebra
authored andcommitted
util: Add UnintrruptibleSleep
1 parent 26b128a commit 004c064

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/utiltime.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,12 @@
1515
#include <boost/date_time/posix_time/posix_time.hpp>
1616
#include <boost/thread.hpp>
1717
#include <ctime>
18+
#include <thread>
1819
#include <tinyformat.h>
1920

2021

22+
void UninterruptibleSleep(const std::chrono::microseconds& n) { std::this_thread::sleep_for(n); }
23+
2124
static std::atomic<int64_t> nMockTime(0); //!< For unit testing
2225

2326

src/utiltime.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111
#include <string>
1212
#include <chrono>
1313

14+
void UninterruptibleSleep(const std::chrono::microseconds& n);
15+
1416
/**
1517
* DEPRECATED
1618
* Use either GetSystemTimeInSeconds (not mockable) or GetTime<T> (mockable)

0 commit comments

Comments
 (0)