mirror of
https://git.h3cjp.net/H3cJP/citra.git
synced 2024-12-26 13:16:58 +00:00
Merge pull request #9040 from liamwhite/woe-thirty-two
core_timing: use high-precision sleeps on non-Windows targets
This commit is contained in:
commit
0b9f2c2f14
|
@ -270,6 +270,7 @@ void CoreTiming::ThreadLoop() {
|
||||||
// There are more events left in the queue, wait until the next event.
|
// There are more events left in the queue, wait until the next event.
|
||||||
const auto wait_time = *next_time - GetGlobalTimeNs().count();
|
const auto wait_time = *next_time - GetGlobalTimeNs().count();
|
||||||
if (wait_time > 0) {
|
if (wait_time > 0) {
|
||||||
|
#ifdef _WIN32
|
||||||
// Assume a timer resolution of 1ms.
|
// Assume a timer resolution of 1ms.
|
||||||
static constexpr s64 TimerResolutionNS = 1000000;
|
static constexpr s64 TimerResolutionNS = 1000000;
|
||||||
|
|
||||||
|
@ -287,6 +288,9 @@ void CoreTiming::ThreadLoop() {
|
||||||
if (event.IsSet()) {
|
if (event.IsSet()) {
|
||||||
event.Reset();
|
event.Reset();
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
event.WaitFor(std::chrono::nanoseconds(wait_time));
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Queue is empty, wait until another event is scheduled and signals us to continue.
|
// Queue is empty, wait until another event is scheduled and signals us to continue.
|
||||||
|
|
Loading…
Reference in a new issue