adapt to new list interface
This commit is contained in:
@ -108,7 +108,7 @@ void Scheduler::kill(Thread* that) {
|
|||||||
|
|
||||||
// Thread-Wechsel durch PIT verhindern
|
// Thread-Wechsel durch PIT verhindern
|
||||||
cpu.disable_int();
|
cpu.disable_int();
|
||||||
if (this->ready_queue.remove(that) == -1) {
|
if (!this->ready_queue.remove(that)) {
|
||||||
log << ERROR << "Can't kill thread that is not in ready_queue, ID: " << dec << that->tid << endl;
|
log << ERROR << "Can't kill thread that is not in ready_queue, ID: " << dec << that->tid << endl;
|
||||||
cpu.enable_int();
|
cpu.enable_int();
|
||||||
return;
|
return;
|
||||||
|
|||||||
@ -44,10 +44,6 @@ private:
|
|||||||
public:
|
public:
|
||||||
Scheduler() : has_idle_thread(false), log("SCHED") {}
|
Scheduler() : has_idle_thread(false), log("SCHED") {}
|
||||||
|
|
||||||
void init() {
|
|
||||||
this->ready_queue.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Scheduler initialisiert?
|
// Scheduler initialisiert?
|
||||||
// Zeitgeber-Unterbrechung kommt evt. bevor der Scheduler fertig
|
// Zeitgeber-Unterbrechung kommt evt. bevor der Scheduler fertig
|
||||||
// intiialisiert wurde!
|
// intiialisiert wurde!
|
||||||
|
|||||||
@ -28,9 +28,7 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
// Konstruktor: Initialisieren des Semaphorzaehlers
|
// Konstruktor: Initialisieren des Semaphorzaehlers
|
||||||
Semaphore(int c) : counter(c) {
|
Semaphore(int c) : counter(c) {}
|
||||||
waitQueue.init();
|
|
||||||
}
|
|
||||||
|
|
||||||
// 'Passieren': Warten auf das Freiwerden eines kritischen Abschnitts.
|
// 'Passieren': Warten auf das Freiwerden eines kritischen Abschnitts.
|
||||||
void p();
|
void p();
|
||||||
|
|||||||
@ -58,10 +58,6 @@ int main() {
|
|||||||
// This has to happen after the allocator is initialized but before the scheduler is started
|
// This has to happen after the allocator is initialized but before the scheduler is started
|
||||||
pg_init();
|
pg_init();
|
||||||
|
|
||||||
// NOTE: Because I introduced dynamic memory inside the scheduler (probably bad idea?) I have to add
|
|
||||||
// these init methods (allocator has to be initialized before but scheduler is constructed in the globals)
|
|
||||||
scheduler.init();
|
|
||||||
|
|
||||||
// Scheduler starten (schedule() erzeugt den Idle-Thread)
|
// Scheduler starten (schedule() erzeugt den Idle-Thread)
|
||||||
scheduler.ready(new MainMenu()); // NOTE: A thread that manages other threads has to be added before scheduler.schedule(),
|
scheduler.ready(new MainMenu()); // NOTE: A thread that manages other threads has to be added before scheduler.schedule(),
|
||||||
// because scheduler.schedule() doesn't return, only threads get cpu time
|
// because scheduler.schedule() doesn't return, only threads get cpu time
|
||||||
|
|||||||
@ -13,7 +13,6 @@ private:
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
ArrayListDemo() {
|
ArrayListDemo() {
|
||||||
this->list.init();
|
|
||||||
kout << "Initialized ArrayListDemo" << endl;
|
kout << "Initialized ArrayListDemo" << endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user