diff --git a/c_os/kernel/threads/Scheduler.cc b/c_os/kernel/threads/Scheduler.cc index 35af795..dead80a 100644 --- a/c_os/kernel/threads/Scheduler.cc +++ b/c_os/kernel/threads/Scheduler.cc @@ -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());