From 1d65ba37a660a7c75b2c47c6e7b4edee6924eaa0 Mon Sep 17 00:00:00 2001 From: Dakoda Greaves Date: Fri, 29 Mar 2024 19:48:35 -0700 Subject: [PATCH] util: Add UnintrruptibleSleep Cherry-picked from: fa4620be782c2bf6b5ffddf4f671194fdd1536f3 --- src/utiltime.cpp | 4 ++++ src/utiltime.h | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/utiltime.cpp b/src/utiltime.cpp index 467d2553624..e926cf3811d 100644 --- a/src/utiltime.cpp +++ b/src/utiltime.cpp @@ -13,9 +13,13 @@ #include #include #include +#include +#include using namespace std; +void UninterruptibleSleep(const std::chrono::microseconds& n) { std::this_thread::sleep_for(n); } + static std::atomic nMockTime(0); //!< For testing int64_t GetTime() diff --git a/src/utiltime.h b/src/utiltime.h index 3fe1781a40c..cd8f2006887 100644 --- a/src/utiltime.h +++ b/src/utiltime.h @@ -9,6 +9,9 @@ #include #include +#include + +void UninterruptibleSleep(const std::chrono::microseconds& n); /** * GetTimeMicros() and GetTimeMillis() both return the system time, but in