summaryrefslogtreecommitdiffstats
path: root/src/core/core_timing.cpp
diff options
context:
space:
mode:
authorbunnei <bunneidev@gmail.com>2020-07-09 21:33:41 +0200
committerGitHub <noreply@github.com>2020-07-09 21:33:41 +0200
commit83b1b259bd88af4ff699813fb179e7e96238da9c (patch)
treeb0e3189dcd07b4bd5e09901408b56ec9c018b685 /src/core/core_timing.cpp
parentMerge pull request #4219 from ogniK5377/audio-timing (diff)
parentcore_timing,scheduler: Use std::scoped_lock when possible (diff)
downloadyuzu-83b1b259bd88af4ff699813fb179e7e96238da9c.tar
yuzu-83b1b259bd88af4ff699813fb179e7e96238da9c.tar.gz
yuzu-83b1b259bd88af4ff699813fb179e7e96238da9c.tar.bz2
yuzu-83b1b259bd88af4ff699813fb179e7e96238da9c.tar.lz
yuzu-83b1b259bd88af4ff699813fb179e7e96238da9c.tar.xz
yuzu-83b1b259bd88af4ff699813fb179e7e96238da9c.tar.zst
yuzu-83b1b259bd88af4ff699813fb179e7e96238da9c.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) {