From 51d7f6bffcc0498a47abc7de27bf0906fc523dae Mon Sep 17 00:00:00 2001 From: Lioncash Date: Fri, 15 Mar 2019 23:38:51 -0400 Subject: kernel/thread: Move thread exiting logic from ExitCurrentThread to svcExitThread Puts the operation on global state in the same places as the rest of the svc calls. --- src/core/hle/kernel/svc.cpp | 10 +++++++--- src/core/hle/kernel/thread.h | 5 ----- 2 files changed, 7 insertions(+), 8 deletions(-) (limited to 'src/core/hle') diff --git a/src/core/hle/kernel/svc.cpp b/src/core/hle/kernel/svc.cpp index bf77ce137..047fa0c19 100644 --- a/src/core/hle/kernel/svc.cpp +++ b/src/core/hle/kernel/svc.cpp @@ -1284,10 +1284,14 @@ static ResultCode StartThread(Handle thread_handle) { /// Called when a thread exits static void ExitThread() { - LOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", Core::CurrentArmInterface().GetPC()); + auto& system = Core::System::GetInstance(); - ExitCurrentThread(); - Core::System::GetInstance().PrepareReschedule(); + LOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", system.CurrentArmInterface().GetPC()); + + auto* const current_thread = system.CurrentScheduler().GetCurrentThread(); + current_thread->Stop(); + system.CurrentScheduler().RemoveThread(current_thread); + system.PrepareReschedule(); } /// Sleep the current thread diff --git a/src/core/hle/kernel/thread.h b/src/core/hle/kernel/thread.h index d7c7a31f7..ccdefeecc 100644 --- a/src/core/hle/kernel/thread.h +++ b/src/core/hle/kernel/thread.h @@ -463,9 +463,4 @@ private: */ Thread* GetCurrentThread(); -/** - * Stops the current thread and removes it from the thread_list - */ -void ExitCurrentThread(); - } // namespace Kernel -- cgit v1.2.3