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.
This commit is contained in:
parent
c892cf01fa
commit
51d7f6bffc
|
@ -1284,10 +1284,14 @@ static ResultCode StartThread(Handle thread_handle) {
|
||||||
|
|
||||||
/// Called when a thread exits
|
/// Called when a thread exits
|
||||||
static void ExitThread() {
|
static void ExitThread() {
|
||||||
LOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", Core::CurrentArmInterface().GetPC());
|
auto& system = Core::System::GetInstance();
|
||||||
|
|
||||||
ExitCurrentThread();
|
LOG_TRACE(Kernel_SVC, "called, pc=0x{:08X}", system.CurrentArmInterface().GetPC());
|
||||||
Core::System::GetInstance().PrepareReschedule();
|
|
||||||
|
auto* const current_thread = system.CurrentScheduler().GetCurrentThread();
|
||||||
|
current_thread->Stop();
|
||||||
|
system.CurrentScheduler().RemoveThread(current_thread);
|
||||||
|
system.PrepareReschedule();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Sleep the current thread
|
/// Sleep the current thread
|
||||||
|
|
|
@ -463,9 +463,4 @@ private:
|
||||||
*/
|
*/
|
||||||
Thread* GetCurrentThread();
|
Thread* GetCurrentThread();
|
||||||
|
|
||||||
/**
|
|
||||||
* Stops the current thread and removes it from the thread_list
|
|
||||||
*/
|
|
||||||
void ExitCurrentThread();
|
|
||||||
|
|
||||||
} // namespace Kernel
|
} // namespace Kernel
|
||||||
|
|
Reference in New Issue