diff options
Diffstat (limited to 'src/core/core_timing.cpp')
| -rw-r--r-- | src/core/core_timing.cpp | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 140578069..07b8e356b 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp | |||
| @@ -61,12 +61,7 @@ void CoreTiming::Initialize(std::function<void()>&& on_thread_init_) { | |||
| 61 | const auto empty_timed_callback = [](std::uintptr_t, std::chrono::nanoseconds) {}; | 61 | const auto empty_timed_callback = [](std::uintptr_t, std::chrono::nanoseconds) {}; |
| 62 | ev_lost = CreateEvent("_lost_event", empty_timed_callback); | 62 | ev_lost = CreateEvent("_lost_event", empty_timed_callback); |
| 63 | if (is_multicore) { | 63 | if (is_multicore) { |
| 64 | const auto hardware_concurrency = std::thread::hardware_concurrency(); | 64 | worker_threads.emplace_back(ThreadEntry, std::ref(*this), 0); |
| 65 | size_t id = 0; | ||
| 66 | worker_threads.emplace_back(ThreadEntry, std::ref(*this), id++); | ||
| 67 | if (hardware_concurrency > 8) { | ||
| 68 | worker_threads.emplace_back(ThreadEntry, std::ref(*this), id++); | ||
| 69 | } | ||
| 70 | } | 65 | } |
| 71 | } | 66 | } |
| 72 | 67 | ||
| @@ -228,14 +223,11 @@ std::optional<s64> CoreTiming::Advance() { | |||
| 228 | event_queue.pop_back(); | 223 | event_queue.pop_back(); |
| 229 | 224 | ||
| 230 | if (const auto event_type{evt.type.lock()}) { | 225 | if (const auto event_type{evt.type.lock()}) { |
| 231 | sequence_mutex.lock(); | 226 | |
| 232 | event_mutex.unlock(); | 227 | event_mutex.unlock(); |
| 233 | 228 | ||
| 234 | event_type->guard.lock(); | ||
| 235 | sequence_mutex.unlock(); | ||
| 236 | const s64 delay = static_cast<s64>(GetGlobalTimeNs().count() - evt.time); | 229 | const s64 delay = static_cast<s64>(GetGlobalTimeNs().count() - evt.time); |
| 237 | event_type->callback(evt.user_data, std::chrono::nanoseconds{delay}); | 230 | event_type->callback(evt.user_data, std::chrono::nanoseconds{delay}); |
| 238 | event_type->guard.unlock(); | ||
| 239 | 231 | ||
| 240 | event_mutex.lock(); | 232 | event_mutex.lock(); |
| 241 | pending_events.fetch_sub(1, std::memory_order_relaxed); | 233 | pending_events.fetch_sub(1, std::memory_order_relaxed); |