Browse Source
Merge pull request #9040 from liamwhite/woe-thirty-two
core_timing: use high-precision sleeps on non-Windows targets
pull/15/merge
bunnei
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
4 additions and
0 deletions
-
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.
|
|
|
|
|