// vim: set noet ts=4 sw=4: #include "scheduler.h" #include "../arch/lapic.h" #include "dispatcher.h" #include "../interrupt/guard.h" #include "../debug/output.h" Queue readyList = Queue(); Scheduler::Scheduler() { } Thread* Scheduler::getNext() { return nullptr; } void Scheduler::schedule() { // TODO maybe guard? Thread* next = readyList.dequeue(); assert(next != nullptr); dispatcher.go(next); } void Scheduler::ready(Thread* that) { assert(that != nullptr); readyList.enqueue(*that); } void Scheduler::resume(bool ready) { //if (!active()->kill_flag) if (ready) readyList.enqueue(*active()); Thread* thread = readyList.dequeue(); assert(thread != nullptr); dispatcher.dispatch(thread); } void Scheduler::exit() { Thread* thread = readyList.dequeue(); assert(thread != nullptr); dispatcher.dispatch(thread); } void Scheduler::kill(Thread* that) { readyList.remove(that); that->kill_flag = true; DBG << "kill..." << flush; for(uint8_t i=0;i(i) << "! killing...\n" << flush; return; } DBG << "not found\n" << flush; } bool Scheduler::isActive(const Thread* thread, unsigned int* cpu) { (void)thread; (void)cpu; return false; } bool Scheduler::isEmpty() const { return false; } void Scheduler::setIdle(IdleThread* that) { (void)that; }