kernel: Unconditionally set thread state when appropriate

This commit is contained in:
Morph 2021-06-10 14:26:54 -04:00
parent aa79ca7a7a
commit ebd38d66db
2 changed files with 12 additions and 23 deletions

View file

@ -201,17 +201,15 @@ bool KProcess::ReleaseUserException(KThread* thread) {
// Remove waiter thread.
s32 num_waiters{};
KThread* next = thread->RemoveWaiterByKey(
std::addressof(num_waiters),
reinterpret_cast<uintptr_t>(std::addressof(exception_thread)));
if (next != nullptr) {
if (next->GetState() == ThreadState::Waiting) {
next->SetState(ThreadState::Runnable);
} else {
KScheduler::SetSchedulerUpdateNeeded(kernel);
}
if (KThread* next = thread->RemoveWaiterByKey(
std::addressof(num_waiters),
reinterpret_cast<uintptr_t>(std::addressof(exception_thread)));
next != nullptr) {
next->SetState(ThreadState::Runnable);
}
KScheduler::SetSchedulerUpdateNeeded(kernel);
return true;
} else {
return false;