Kernel: Don't idle on svcSleepThread(0)

This commit is contained in:
wheremyfoodat 2023-08-02 18:47:53 +03:00
parent 66847d4570
commit 60de6a65f5

View file

@ -348,7 +348,11 @@ void Kernel::sleepThread(s64 ns) {
t.status = ThreadStatus::Ready; t.status = ThreadStatus::Ready;
if (nextThreadIndex.has_value()) { if (nextThreadIndex.has_value()) {
switchThread(nextThreadIndex.value()); const auto index = nextThreadIndex.value();
if (index != idleThreadIndex) {
switchThread(index);
}
} }
} else { // If we're sleeping for >= 0 ns } else { // If we're sleeping for >= 0 ns
Thread& t = threads[currentThreadIndex]; Thread& t = threads[currentThreadIndex];