[Kernel] Implement thread sleeping

This commit is contained in:
wheremyfoodat 2022-10-11 22:45:25 +03:00
parent db0adc55c1
commit 2a4709dcfa
6 changed files with 60 additions and 7 deletions

View file

@ -94,5 +94,14 @@ void Kernel::waitSynchronizationN() {
printf("Hacky WaitSync stuff for OoT triggered!!!\n");
threads[currentThreadIndex].status = ThreadStatus::Ready;
switchThread(rand() % threadCount);
while (1) {
auto index = rand() % threadCount;
auto& thread = threads[index];
if (canThreadRun(thread)) {
switchThread(rand() % threadCount);
break;
}
}
}