summaryrefslogtreecommitdiff
path: root/src/core/core_timing.cpp
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2021-11-28 13:47:40 +0100
committerGravatar Fernando Sahmkow2022-06-28 01:10:55 +0200
commit38e4a144a1e6f399482eb586c1e0d5646fae9679 (patch)
tree8079072946451c23e2a664f990234e6c76512297 /src/core/core_timing.cpp
parentCore: Fix tests. (diff)
downloadyuzu-38e4a144a1e6f399482eb586c1e0d5646fae9679.tar.gz
yuzu-38e4a144a1e6f399482eb586c1e0d5646fae9679.tar.xz
yuzu-38e4a144a1e6f399482eb586c1e0d5646fae9679.zip
Core: Protect each event from race conditions within it.
Diffstat (limited to 'src/core/core_timing.cpp')
-rw-r--r--src/core/core_timing.cpp1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index b6c295ada..18dfa07f5 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -226,6 +226,7 @@ std::optional<s64> CoreTiming::Advance() {
226 event_mutex.unlock(); 226 event_mutex.unlock();
227 227
228 if (const auto event_type{evt.type.lock()}) { 228 if (const auto event_type{evt.type.lock()}) {
229 std::unique_lock<std::mutex> lk(event_type->guard);
229 event_type->callback(evt.user_data, std::chrono::nanoseconds{static_cast<s64>( 230 event_type->callback(evt.user_data, std::chrono::nanoseconds{static_cast<s64>(
230 GetGlobalTimeNs().count() - evt.time)}); 231 GetGlobalTimeNs().count() - evt.time)});
231 } 232 }