VERY experimental Nintendo Switch 2 emulator
C++
Core: Protect each event from race conditions within it.
Fernando Sahmkow004329295130
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cppindex b6c295ada6..18dfa07f51 100644--- a/src/core/core_timing.cpp+++ b/src/core/core_timing.cpp@@ -226,6 +226,7 @@ std::optional<s64> CoreTiming::Advance() {event_mutex.unlock();if (const auto event_type{evt.type.lock()}) {+ std::unique_lock<std::mutex> lk(event_type->guard);event_type->callback(evt.user_data, std::chrono::nanoseconds{static_cast<s64>(GetGlobalTimeNs().count() - evt.time)});}diff --git a/src/core/core_timing.h b/src/core/core_timing.hindex 901bf532ed..4fef6fcce1 100644--- a/src/core/core_timing.h+++ b/src/core/core_timing.h@@ -32,6 +32,7 @@ struct EventType {TimedCallback callback;/// A pointer to the name of the event.const std::string name;+ mutable std::mutex guard;};/**