1

fix scheduling bug when only 1 thread is available

This commit is contained in:
2022-07-04 14:54:25 +02:00
parent 7fe5d8e956
commit 1f01a561a3

View File

@ -96,10 +96,12 @@ void Scheduler::yield() {
/* hier muss Code eingefuegt werden */
// if (this->readyQueue.isEmpty()) {
// // Idle thread running
// return;
// }
// When only one thread exists (IdleThread) it can't yield as the readyqueue becomes empty
// and this is not handled anywhere else
if (this->readyQueue.isEmpty()) {
// Idle thread running
return;
}
Thread& next = *(Thread*)this->readyQueue.dequeue();
this->readyQueue.enqueue(this->get_active());