summaryrefslogtreecommitdiffstats
path: root/src/core/core_timing.cpp
diff options
context:
space:
mode:
authorReinUsesLisp <reinuseslisp@airmail.cc>2020-06-29 02:42:57 +0200
committerReinUsesLisp <reinuseslisp@airmail.cc>2020-06-29 02:42:57 +0200
commit8562b516c0e3fa25a65e440db29cd474c0cbb896 (patch)
treea9f97fd5b63ac6455e0258dea1dc05ea489051aa /src/core/core_timing.cpp
parentMerge pull request #3955 from FernandoS27/prometheus-2b (diff)
downloadyuzu-8562b516c0e3fa25a65e440db29cd474c0cbb896.tar
yuzu-8562b516c0e3fa25a65e440db29cd474c0cbb896.tar.gz
yuzu-8562b516c0e3fa25a65e440db29cd474c0cbb896.tar.bz2
yuzu-8562b516c0e3fa25a65e440db29cd474c0cbb896.tar.lz
yuzu-8562b516c0e3fa25a65e440db29cd474c0cbb896.tar.xz
yuzu-8562b516c0e3fa25a65e440db29cd474c0cbb896.tar.zst
yuzu-8562b516c0e3fa25a65e440db29cd474c0cbb896.zip
Diffstat (limited to 'src/core/core_timing.cpp')
-rw-r--r--src/core/core_timing.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp
index 5c83c41a4..a63e60461 100644
--- a/src/core/core_timing.cpp
+++ b/src/core/core_timing.cpp
@@ -172,7 +172,7 @@ void CoreTiming::ClearPendingEvents() {
}
void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) {
- basic_lock.lock();
+ std::scoped_lock lock{basic_lock};
const auto itr = std::remove_if(event_queue.begin(), event_queue.end(), [&](const Event& e) {
return e.type.lock().get() == event_type.get();
@@ -183,12 +183,10 @@ void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) {
event_queue.erase(itr, event_queue.end());
std::make_heap(event_queue.begin(), event_queue.end(), std::greater<>());
}
- basic_lock.unlock();
}
std::optional<s64> CoreTiming::Advance() {
- std::scoped_lock advance_scope{advance_lock};
- std::scoped_lock basic_scope{basic_lock};
+ std::scoped_lock lock{advance_lock, basic_lock};
global_timer = GetGlobalTimeNs().count();
while (!event_queue.empty() && event_queue.front().time <= global_timer) {