mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-12 23:18:14 +01:00
Rename util.h Sleep --> MilliSleep
Two reasons for this change: 1. Need to always use boost::thread's sleep, even on Windows, so the sleeps can be interrupted (prior code used Windows' built-in Sleep). 2. I always forgot what units the old Sleep took.
This commit is contained in:
15
src/util.h
15
src/util.h
@@ -100,14 +100,17 @@ T* alignup(T* p)
|
||||
#endif
|
||||
#else
|
||||
#define MAX_PATH 1024
|
||||
inline void Sleep(int64 n)
|
||||
{
|
||||
/*Boost has a year 2038 problem— if the request sleep time is past epoch+2^31 seconds the sleep returns instantly.
|
||||
So we clamp our sleeps here to 10 years and hope that boost is fixed by 2028.*/
|
||||
boost::thread::sleep(boost::get_system_time() + boost::posix_time::milliseconds(n>315576000000LL?315576000000LL:n));
|
||||
}
|
||||
#endif
|
||||
|
||||
inline void MilliSleep(int64 n)
|
||||
{
|
||||
#if BOOST_VERSION >= 105000
|
||||
boost::this_thread::sleep_for(boost::chrono::milliseconds(n));
|
||||
#else
|
||||
boost::this_thread::sleep(boost::posix_time::milliseconds(n));
|
||||
#endif
|
||||
}
|
||||
|
||||
/* This GNU C extension enables the compiler to check the format string against the parameters provided.
|
||||
* X is the number of the "format string" parameter, and Y is the number of the first variadic parameter.
|
||||
* Parameters count from 1.
|
||||
|
||||
Reference in New Issue
Block a user