core: hle: kernel: Ensure idle threads are closed before destroying scheduler.

This commit is contained in:
bunnei
2021-08-06 22:58:46 -07:00
parent 669a2d2c67
commit 3bd5d4b6f8
3 changed files with 22 additions and 24 deletions

View File

@ -617,13 +617,17 @@ KScheduler::KScheduler(Core::System& system_, s32 core_id_) : system{system_}, c
state.highest_priority_thread = nullptr;
}
KScheduler::~KScheduler() {
void KScheduler::Finalize() {
if (idle_thread) {
idle_thread->Close();
idle_thread = nullptr;
}
}
KScheduler::~KScheduler() {
ASSERT(!idle_thread);
}
KThread* KScheduler::GetCurrentThread() const {
if (auto result = current_thread.load(); result) {
return result;