diff options
Diffstat (limited to 'src/core/core_timing.cpp')
| -rw-r--r-- | src/core/core_timing.cpp | 6 |
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() { | |||
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) { | 174 | void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) { |
| 175 | basic_lock.lock(); | 175 | std::scoped_lock lock{basic_lock}; |
| 176 | 176 | ||
| 177 | const auto itr = std::remove_if(event_queue.begin(), event_queue.end(), [&](const Event& e) { | 177 | const auto itr = std::remove_if(event_queue.begin(), event_queue.end(), [&](const Event& e) { |
| 178 | return e.type.lock().get() == event_type.get(); | 178 | return e.type.lock().get() == event_type.get(); |
| @@ -183,12 +183,10 @@ void CoreTiming::RemoveEvent(const std::shared_ptr<EventType>& event_type) { | |||
| 183 | event_queue.erase(itr, event_queue.end()); | 183 | event_queue.erase(itr, event_queue.end()); |
| 184 | std::make_heap(event_queue.begin(), event_queue.end(), std::greater<>()); | 184 | std::make_heap(event_queue.begin(), event_queue.end(), std::greater<>()); |
| 185 | } | 185 | } |
| 186 | basic_lock.unlock(); | ||
| 187 | } | 186 | } |
| 188 | 187 | ||
| 189 | std::optional<s64> CoreTiming::Advance() { | 188 | std::optional<s64> CoreTiming::Advance() { |
| 190 | std::scoped_lock advance_scope{advance_lock}; | 189 | std::scoped_lock lock{advance_lock, basic_lock}; |
| 191 | std::scoped_lock basic_scope{basic_lock}; | ||
| 192 | global_timer = GetGlobalTimeNs().count(); | 190 | global_timer = GetGlobalTimeNs().count(); |
| 193 | 191 | ||
| 194 | while (!event_queue.empty() && event_queue.front().time <= global_timer) { | 192 | while (!event_queue.empty() && event_queue.front().time <= global_timer) { |