diff options
| author | 2020-03-11 20:44:53 -0400 | |
|---|---|---|
| committer | 2020-06-27 11:35:47 -0400 | |
| commit | e6f8bde74b9476dced103c6c54ab81616d34b97e (patch) | |
| tree | 488d71b9de2368944b99b0a188adb84826f1167a /src/core | |
| parent | Kernel: Rewind on SVC change. (diff) | |
| download | yuzu-e6f8bde74b9476dced103c6c54ab81616d34b97e.tar.gz yuzu-e6f8bde74b9476dced103c6c54ab81616d34b97e.tar.xz yuzu-e6f8bde74b9476dced103c6c54ab81616d34b97e.zip | |
General: Fix Stop function
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/core_timing.cpp | 1 | ||||
| -rw-r--r-- | src/core/hle/kernel/kernel.cpp | 15 | ||||
| -rw-r--r-- | src/core/hle/kernel/thread.cpp | 8 |
3 files changed, 21 insertions, 3 deletions
diff --git a/src/core/core_timing.cpp b/src/core/core_timing.cpp index c91ae9975..3438f79ce 100644 --- a/src/core/core_timing.cpp +++ b/src/core/core_timing.cpp | |||
| @@ -61,6 +61,7 @@ void CoreTiming::Initialize(std::function<void(void)>&& on_thread_init_) { | |||
| 61 | void CoreTiming::Shutdown() { | 61 | void CoreTiming::Shutdown() { |
| 62 | paused = true; | 62 | paused = true; |
| 63 | shutting_down = true; | 63 | shutting_down = true; |
| 64 | pause_event.Set(); | ||
| 64 | event.Set(); | 65 | event.Set(); |
| 65 | timer_thread->join(); | 66 | timer_thread->join(); |
| 66 | ClearPendingEvents(); | 67 | ClearPendingEvents(); |
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index 2a1b91752..24da4367e 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp | |||
| @@ -119,6 +119,7 @@ struct KernelCore::Impl { | |||
| 119 | 119 | ||
| 120 | void Initialize(KernelCore& kernel) { | 120 | void Initialize(KernelCore& kernel) { |
| 121 | Shutdown(); | 121 | Shutdown(); |
| 122 | RegisterHostThread(); | ||
| 122 | 123 | ||
| 123 | InitializePhysicalCores(); | 124 | InitializePhysicalCores(); |
| 124 | InitializeSystemResourceLimit(kernel); | 125 | InitializeSystemResourceLimit(kernel); |
| @@ -135,6 +136,19 @@ struct KernelCore::Impl { | |||
| 135 | next_user_process_id = Process::ProcessIDMin; | 136 | next_user_process_id = Process::ProcessIDMin; |
| 136 | next_thread_id = 1; | 137 | next_thread_id = 1; |
| 137 | 138 | ||
| 139 | for (std::size_t i = 0; i < Core::Hardware::NUM_CPU_CORES; i++) { | ||
| 140 | if (suspend_threads[i]) { | ||
| 141 | suspend_threads[i].reset(); | ||
| 142 | } | ||
| 143 | } | ||
| 144 | |||
| 145 | for (std::size_t i = 0; i < cores.size(); i++) { | ||
| 146 | cores[i].Shutdown(); | ||
| 147 | } | ||
| 148 | cores.clear(); | ||
| 149 | |||
| 150 | registered_core_threads.reset(); | ||
| 151 | |||
| 138 | process_list.clear(); | 152 | process_list.clear(); |
| 139 | current_process = nullptr; | 153 | current_process = nullptr; |
| 140 | 154 | ||
| @@ -154,6 +168,7 @@ struct KernelCore::Impl { | |||
| 154 | cores.clear(); | 168 | cores.clear(); |
| 155 | 169 | ||
| 156 | exclusive_monitor.reset(); | 170 | exclusive_monitor.reset(); |
| 171 | host_thread_ids.clear(); | ||
| 157 | } | 172 | } |
| 158 | 173 | ||
| 159 | void InitializePhysicalCores() { | 174 | void InitializePhysicalCores() { |
diff --git a/src/core/hle/kernel/thread.cpp b/src/core/hle/kernel/thread.cpp index 1c32552b1..6f8e7a070 100644 --- a/src/core/hle/kernel/thread.cpp +++ b/src/core/hle/kernel/thread.cpp | |||
| @@ -56,10 +56,12 @@ void Thread::Stop() { | |||
| 56 | Signal(); | 56 | Signal(); |
| 57 | kernel.GlobalHandleTable().Close(global_handle); | 57 | kernel.GlobalHandleTable().Close(global_handle); |
| 58 | 58 | ||
| 59 | owner_process->UnregisterThread(this); | 59 | if (owner_process) { |
| 60 | owner_process->UnregisterThread(this); | ||
| 60 | 61 | ||
| 61 | // Mark the TLS slot in the thread's page as free. | 62 | // Mark the TLS slot in the thread's page as free. |
| 62 | owner_process->FreeTLSRegion(tls_address); | 63 | owner_process->FreeTLSRegion(tls_address); |
| 64 | } | ||
| 63 | } | 65 | } |
| 64 | global_handle = 0; | 66 | global_handle = 0; |
| 65 | } | 67 | } |