diff options
author | Narr the Reg <juangerman-13@hotmail.com> | 2024-01-31 17:25:28 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-31 17:25:28 +0100 |
commit | 7cc7d027f74b5bffc0b3f8f3a6c3110999c7cc4c (patch) | |
tree | 24b2ed412f2683c8460839778ea7761d052bc38f /src/core/hle/kernel/kernel.cpp | |
parent | Merge pull request #12858 from liamwhite/non-blocking (diff) | |
parent | am: push storage from error applet with non-zero size (diff) | |
download | yuzu-7cc7d027f74b5bffc0b3f8f3a6c3110999c7cc4c.tar yuzu-7cc7d027f74b5bffc0b3f8f3a6c3110999c7cc4c.tar.gz yuzu-7cc7d027f74b5bffc0b3f8f3a6c3110999c7cc4c.tar.bz2 yuzu-7cc7d027f74b5bffc0b3f8f3a6c3110999c7cc4c.tar.lz yuzu-7cc7d027f74b5bffc0b3f8f3a6c3110999c7cc4c.tar.xz yuzu-7cc7d027f74b5bffc0b3f8f3a6c3110999c7cc4c.tar.zst yuzu-7cc7d027f74b5bffc0b3f8f3a6c3110999c7cc4c.zip |
Diffstat (limited to '')
-rw-r--r-- | src/core/hle/kernel/kernel.cpp | 30 |
1 files changed, 14 insertions, 16 deletions
diff --git a/src/core/hle/kernel/kernel.cpp b/src/core/hle/kernel/kernel.cpp index f3683cdcc..34b25be66 100644 --- a/src/core/hle/kernel/kernel.cpp +++ b/src/core/hle/kernel/kernel.cpp @@ -97,8 +97,14 @@ struct KernelCore::Impl { RegisterHostThread(nullptr); } - void TerminateApplicationProcess() { - application_process.load()->Terminate(); + void TerminateAllProcesses() { + std::scoped_lock lk{process_list_lock}; + for (auto& process : process_list) { + process->Terminate(); + process->Close(); + process = nullptr; + } + process_list.clear(); } void Shutdown() { @@ -107,18 +113,9 @@ struct KernelCore::Impl { CloseServices(); - auto* old_process = application_process.exchange(nullptr); - if (old_process) { - old_process->Close(); - } - - { - std::scoped_lock lk{process_list_lock}; - for (auto* const process : process_list) { - process->Terminate(); - process->Close(); - } - process_list.clear(); + if (application_process) { + application_process->Close(); + application_process = nullptr; } next_object_id = 0; @@ -354,6 +351,7 @@ struct KernelCore::Impl { void MakeApplicationProcess(KProcess* process) { application_process = process; + application_process->Open(); } static inline thread_local u8 host_thread_id = UINT8_MAX; @@ -779,7 +777,7 @@ struct KernelCore::Impl { // Lists all processes that exist in the current session. std::mutex process_list_lock; std::vector<KProcess*> process_list; - std::atomic<KProcess*> application_process{}; + KProcess* application_process{}; std::unique_ptr<Kernel::GlobalSchedulerContext> global_scheduler_context; std::unique_ptr<Kernel::KHardwareTimer> hardware_timer; @@ -1243,7 +1241,7 @@ void KernelCore::SuspendApplication(bool suspended) { } void KernelCore::ShutdownCores() { - impl->TerminateApplicationProcess(); + impl->TerminateAllProcesses(); KScopedSchedulerLock lk{*this}; |