diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/core_timing.cpp | 12 | ||||
| -rw-r--r-- | src/core/core_timing.h | 2 |
2 files changed, 2 insertions, 12 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); |
diff --git a/src/core/core_timing.h b/src/core/core_timing.h index a86553e08..c52bffb3b 100644 --- a/src/core/core_timing.h +++ b/src/core/core_timing.h | |||
| @@ -32,7 +32,6 @@ struct EventType { | |||
| 32 | TimedCallback callback; | 32 | TimedCallback callback; |
| 33 | /// A pointer to the name of the event. | 33 | /// A pointer to the name of the event. |
| 34 | const std::string name; | 34 | const std::string name; |
| 35 | mutable std::mutex guard; | ||
| 36 | }; | 35 | }; |
| 37 | 36 | ||
| 38 | /** | 37 | /** |
| @@ -157,7 +156,6 @@ private: | |||
| 157 | std::condition_variable wait_pause_cv; | 156 | std::condition_variable wait_pause_cv; |
| 158 | std::condition_variable wait_signal_cv; | 157 | std::condition_variable wait_signal_cv; |
| 159 | mutable std::mutex event_mutex; | 158 | mutable std::mutex event_mutex; |
| 160 | mutable std::mutex sequence_mutex; | ||
| 161 | 159 | ||
| 162 | std::atomic<bool> paused_state{}; | 160 | std::atomic<bool> paused_state{}; |
| 163 | bool is_paused{}; | 161 | bool is_paused{}; |