summaryrefslogtreecommitdiffstats
path: root/src/core/core_timing.cpp
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2020-03-03 20:50:38 +0100
committerFernando Sahmkow <fsahmkow27@gmail.com>2020-06-27 17:35:23 +0200
commit07993ac8c8c66bbf638dddc7750106f6dfb0e09b (patch)
treedae8c8249f66657e232dc2620489d237e17459c8 /src/core/core_timing.cpp
parentKernel: Correct Signal on Thread Death and Setup Sync Objects on Thread for Debugging (diff)
downloadyuzu-07993ac8c8c66bbf638dddc7750106f6dfb0e09b.tar
yuzu-07993ac8c8c66bbf638dddc7750106f6dfb0e09b.tar.gz
yuzu-07993ac8c8c66bbf638dddc7750106f6dfb0e09b.tar.bz2
yuzu-07993ac8c8c66bbf638dddc7750106f6dfb0e09b.tar.lz
yuzu-07993ac8c8c66bbf638dddc7750106f6dfb0e09b.tar.xz
yuzu-07993ac8c8c66bbf638dddc7750106f6dfb0e09b.tar.zst
yuzu-07993ac8c8c66bbf638dddc7750106f6dfb0e09b.zip
Diffstat (limited to 'src/core/core_timing.cpp')
-rw-r--r--src/core/core_timing.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 5a7abcfca..c91ae9975 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -154,7 +154,7 @@ void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) {
basic_lock.unlock();
}
-std::optional<u64> CoreTiming::Advance() {
+std::optional<s64> CoreTiming::Advance() {
advance_lock.lock();
basic_lock.lock();
global_timer = GetGlobalTimeNs().count();
@@ -170,10 +170,11 @@ std::optional<u64> CoreTiming::Advance() {
}
basic_lock.lock();
+ global_timer = GetGlobalTimeNs().count();
}
if (!event_queue.empty()) {
- const u64 next_time = event_queue.front().time - global_timer;
+ const s64 next_time = event_queue.front().time - global_timer;
basic_lock.unlock();
advance_lock.unlock();
return next_time;
@@ -191,8 +192,10 @@ void CoreTiming::ThreadLoop() {
paused_set = false;
const auto next_time = Advance();
if (next_time) {
- std::chrono::nanoseconds next_time_ns = std::chrono::nanoseconds(*next_time);
- event.WaitFor(next_time_ns);
+ if (*next_time > 0) {
+ std::chrono::nanoseconds next_time_ns = std::chrono::nanoseconds(*next_time);
+ event.WaitFor(next_time_ns);
+ }
} else {
wait_set = true;
event.Wait();