diff options
| author | 2020-03-19 13:09:32 -0400 | |
|---|---|---|
| committer | 2020-06-27 11:35:52 -0400 | |
| commit | f2ade343e2492c213ac93680a55e9bed712dac9a (patch) | |
| tree | 30bce0eb24a0b2b38310f07fa37c7ba881fc8535 /src/core/core_timing.cpp | |
| parent | GUI: Make multicore only work with Async and add GUI for multicore. (diff) | |
| download | yuzu-f2ade343e2492c213ac93680a55e9bed712dac9a.tar.gz yuzu-f2ade343e2492c213ac93680a55e9bed712dac9a.tar.xz yuzu-f2ade343e2492c213ac93680a55e9bed712dac9a.zip | |
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 3438f79ce..189d4aa34 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_) { | |||
| 55 | event_fifo_id = 0; | 55 | event_fifo_id = 0; |
| 56 | const auto empty_timed_callback = [](u64, s64) {}; | 56 | const auto empty_timed_callback = [](u64, s64) {}; |
| 57 | ev_lost = CreateEvent("_lost_event", empty_timed_callback); | 57 | ev_lost = CreateEvent("_lost_event", empty_timed_callback); |
| 58 | timer_thread = std::make_unique<std::thread>(ThreadEntry, std::ref(*this)); | 58 | if (is_multicore) { |
| 59 | timer_thread = std::make_unique<std::thread>(ThreadEntry, std::ref(*this)); | ||
| 60 | } | ||
| 59 | } | 61 | } |
| 60 | 62 | ||
| 61 | void CoreTiming::Shutdown() { | 63 | void CoreTiming::Shutdown() { |
| @@ -63,7 +65,9 @@ void CoreTiming::Shutdown() { | |||
| 63 | shutting_down = true; | 65 | shutting_down = true; |
| 64 | pause_event.Set(); | 66 | pause_event.Set(); |
| 65 | event.Set(); | 67 | event.Set(); |
| 66 | timer_thread->join(); | 68 | if (timer_thread) { |
| 69 | timer_thread->join(); | ||
| 70 | } | ||
| 67 | ClearPendingEvents(); | 71 | ClearPendingEvents(); |
| 68 | timer_thread.reset(); | 72 | timer_thread.reset(); |
| 69 | has_started = false; | 73 | has_started = false; |
| @@ -78,12 +82,14 @@ void CoreTiming::SyncPause(bool is_paused) { | |||
| 78 | return; | 82 | return; |
| 79 | } | 83 | } |
| 80 | Pause(is_paused); | 84 | Pause(is_paused); |
| 81 | if (!is_paused) { | 85 | if (timer_thread) { |
| 82 | pause_event.Set(); | 86 | if (!is_paused) { |
| 87 | pause_event.Set(); | ||
| 88 | } | ||
| 89 | event.Set(); | ||
| 90 | while (paused_set != is_paused) | ||
| 91 | ; | ||
| 83 | } | 92 | } |
| 84 | event.Set(); | ||
| 85 | while (paused_set != is_paused) | ||
| 86 | ; | ||
| 87 | } | 93 | } |
| 88 | 94 | ||
| 89 | bool CoreTiming::IsRunning() const { | 95 | bool CoreTiming::IsRunning() const { |