diff options
author | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-03-19 13:09:32 -0400 |
---|---|---|
committer | Fernando Sahmkow <fsahmkow27@gmail.com> | 2020-06-27 11:35:52 -0400 |
commit | f2ade343e2492c213ac93680a55e9bed712dac9a (patch) | |
tree | 30bce0eb24a0b2b38310f07fa37c7ba881fc8535 /src/core/core_timing.cpp | |
parent | 5d3a2be04f265c2d6a8687431593029f7329060f (diff) |
SingleCore: Move Host Timing from a sepparate thread to main cpu thread.
Diffstat (limited to 'src/core/core_timing.cpp')
-rw-r--r-- | src/core/core_timing.cpp | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index 3438f79cee..189d4aa34d 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp @@ -55,7 +55,9 @@ void CoreTiming::Initialize(std::function<void(void)>&& on_thread_init_) { event_fifo_id = 0; const auto empty_timed_callback = [](u64, s64) {}; ev_lost = CreateEvent("_lost_event", empty_timed_callback); - timer_thread = std::make_unique<std::thread>(ThreadEntry, std::ref(*this)); + if (is_multicore) { + timer_thread = std::make_unique<std::thread>(ThreadEntry, std::ref(*this)); + } } void CoreTiming::Shutdown() { @@ -63,7 +65,9 @@ void CoreTiming::Shutdown() { shutting_down = true; pause_event.Set(); event.Set(); - timer_thread->join(); + if (timer_thread) { + timer_thread->join(); + } ClearPendingEvents(); timer_thread.reset(); has_started = false; @@ -78,12 +82,14 @@ void CoreTiming::SyncPause(bool is_paused) { return; } Pause(is_paused); - if (!is_paused) { - pause_event.Set(); + if (timer_thread) { + if (!is_paused) { + pause_event.Set(); + } + event.Set(); + while (paused_set != is_paused) + ; } - event.Set(); - while (paused_set != is_paused) - ; } bool CoreTiming::IsRunning() const { |