diff options
author | Liam <byteslice@airmail.cc> | 2022-10-08 18:27:40 -0400 |
---|---|---|
committer | Liam <byteslice@airmail.cc> | 2022-10-08 18:27:40 -0400 |
commit | 96324342438a5ce16ab9fbec6d8c17756ef166ff (patch) | |
tree | 1432040192771049aec6170b4f6e63481dae86e6 /src/core/core_timing.cpp | |
parent | 155213484b9a785c93e16a28285999256587691a (diff) |
core_timing: use high-precision sleeps on non-Windows targets
Diffstat (limited to 'src/core/core_timing.cpp')
-rw-r--r-- | src/core/core_timing.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 6c0fcb7b54..2678ce5328 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -270,6 +270,7 @@ void CoreTiming::ThreadLoop() { // There are more events left in the queue, wait until the next event. const auto wait_time = *next_time - GetGlobalTimeNs().count(); if (wait_time > 0) { +#ifdef _WIN32 // Assume a timer resolution of 1ms. static constexpr s64 TimerResolutionNS = 1000000; @@ -287,6 +288,9 @@ void CoreTiming::ThreadLoop() { if (event.IsSet()) { event.Reset(); } +#else + event.WaitFor(std::chrono::nanoseconds(wait_time)); +#endif } } else { // Queue is empty, wait until another event is scheduled and signals us to continue. |