mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 15:39:05 +01:00
util: Add UnintrruptibleSleep
This commit is contained in:
@@ -13,8 +13,12 @@
|
|||||||
#include <boost/date_time/posix_time/posix_time.hpp>
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
||||||
#include <boost/thread.hpp>
|
#include <boost/thread.hpp>
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
#include <tinyformat.h>
|
#include <tinyformat.h>
|
||||||
|
|
||||||
|
void UninterruptibleSleep(const std::chrono::microseconds& n) { std::this_thread::sleep_for(n); }
|
||||||
|
|
||||||
static std::atomic<int64_t> nMockTime(0); //!< For unit testing
|
static std::atomic<int64_t> nMockTime(0); //!< For unit testing
|
||||||
|
|
||||||
int64_t GetTime()
|
int64_t GetTime()
|
||||||
|
|||||||
@@ -10,6 +10,8 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
|
|
||||||
|
void UninterruptibleSleep(const std::chrono::microseconds& n);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper to count the seconds of a duration.
|
* Helper to count the seconds of a duration.
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user