adapt to new list interface
This commit is contained in:
@ -108,7 +108,7 @@ void Scheduler::kill(Thread* that) {
|
||||
|
||||
// Thread-Wechsel durch PIT verhindern
|
||||
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;
|
||||
cpu.enable_int();
|
||||
return;
|
||||
|
@ -44,10 +44,6 @@ private:
|
||||
public:
|
||||
Scheduler() : has_idle_thread(false), log("SCHED") {}
|
||||
|
||||
void init() {
|
||||
this->ready_queue.init();
|
||||
}
|
||||
|
||||
// Scheduler initialisiert?
|
||||
// Zeitgeber-Unterbrechung kommt evt. bevor der Scheduler fertig
|
||||
// intiialisiert wurde!
|
||||
|
@ -28,9 +28,7 @@ private:
|
||||
|
||||
public:
|
||||
// Konstruktor: Initialisieren des Semaphorzaehlers
|
||||
Semaphore(int c) : counter(c) {
|
||||
waitQueue.init();
|
||||
}
|
||||
Semaphore(int c) : counter(c) {}
|
||||
|
||||
// 'Passieren': Warten auf das Freiwerden eines kritischen Abschnitts.
|
||||
void p();
|
||||
|
@ -58,10 +58,6 @@ int main() {
|
||||
// This has to happen after the allocator is initialized but before the scheduler is started
|
||||
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.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
|
||||
|
@ -13,7 +13,6 @@ private:
|
||||
|
||||
public:
|
||||
ArrayListDemo() {
|
||||
this->list.init();
|
||||
kout << "Initialized ArrayListDemo" << endl;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user