reformat
This commit is contained in:
@ -24,8 +24,8 @@ void Scheduler::schedule() {
|
||||
// We need to start the idle thread first as this one sets the scheduler to initialized
|
||||
// Other wise preemption will be blocked and nothing will happen if the first threads
|
||||
// ready() function is blocking
|
||||
this->start(*(Thread*)new IdleThread()); // The idle thread set initialized to true, so preemption
|
||||
// only starts after this
|
||||
this->start(*(Thread*)new IdleThread()); // The idle thread set initialized to true, so preemption
|
||||
// only starts after this
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -41,12 +41,12 @@ void Scheduler::ready(Thread* that) {
|
||||
/* hier muss Code eingefuegt werden */
|
||||
|
||||
// Thread-Wechsel durch PIT verhindern
|
||||
cpu.disable_int ();
|
||||
cpu.disable_int();
|
||||
|
||||
this->readyQueue.enqueue(that);
|
||||
|
||||
// Thread-Wechsel durch PIT jetzt wieder erlauben
|
||||
cpu.enable_int ();
|
||||
cpu.enable_int();
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -62,7 +62,7 @@ void Scheduler::exit() {
|
||||
/* hier muss Code eingefuegt werden */
|
||||
|
||||
// Thread-Wechsel durch PIT verhindern
|
||||
cpu.disable_int ();
|
||||
cpu.disable_int();
|
||||
|
||||
Thread& next = *(Thread*)this->readyQueue.dequeue();
|
||||
this->dispatch(next);
|
||||
@ -87,12 +87,12 @@ void Scheduler::kill(Thread* that) {
|
||||
/* hier muss Code eingefuegt werden */
|
||||
|
||||
// Thread-Wechsel durch PIT verhindern
|
||||
cpu.disable_int ();
|
||||
cpu.disable_int();
|
||||
|
||||
this->readyQueue.remove(that);
|
||||
|
||||
// Thread-Wechsel durch PIT jetzt wieder erlauben
|
||||
cpu.enable_int ();
|
||||
cpu.enable_int();
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
@ -118,7 +118,7 @@ void Scheduler::yield() {
|
||||
}
|
||||
|
||||
// Thread-Wechsel durch PIT verhindern
|
||||
cpu.disable_int ();
|
||||
cpu.disable_int();
|
||||
|
||||
Thread& next = *(Thread*)this->readyQueue.dequeue();
|
||||
this->readyQueue.enqueue(this->get_active());
|
||||
@ -132,7 +132,7 @@ void Scheduler::yield() {
|
||||
* schaltet auf den naechsten Thread um, sofern einer vor- *
|
||||
* handen ist. *
|
||||
*****************************************************************************/
|
||||
void Scheduler::preempt () {
|
||||
void Scheduler::preempt() {
|
||||
|
||||
/* Hier muss Code eingefuegt werden */
|
||||
|
||||
@ -142,7 +142,7 @@ void Scheduler::preempt () {
|
||||
}
|
||||
|
||||
// Thread-Wechsel durch PIT verhindern
|
||||
cpu.disable_int ();
|
||||
cpu.disable_int();
|
||||
|
||||
Thread& next = *(Thread*)this->readyQueue.dequeue();
|
||||
this->readyQueue.enqueue(this->get_active());
|
||||
|
||||
@ -52,9 +52,8 @@ public:
|
||||
// CPU freiwillig abgeben und Auswahl des naechsten Threads
|
||||
void yield();
|
||||
|
||||
|
||||
// Thread umschalten; wird aus der ISR des PITs gerufen
|
||||
void preempt ();
|
||||
void preempt();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -78,7 +78,7 @@ void Thread_init(struct ThreadState* regs, unsigned int* stack, void (*kickoff)(
|
||||
regs->edx = 0;
|
||||
|
||||
// flags initialisieren
|
||||
regs->efl = (void*)0x200; // Interrupt-Enable
|
||||
regs->efl = (void*)0x200; // Interrupt-Enable
|
||||
}
|
||||
|
||||
/*****************************************************************************
|
||||
|
||||
@ -36,10 +36,10 @@ struct ThreadState {
|
||||
void* esp;
|
||||
// nachfolgend die fluechtige Register
|
||||
// wichtig fuer preemptives Multitasking
|
||||
void *eax;
|
||||
void *ecx;
|
||||
void *edx;
|
||||
void *efl;
|
||||
void* eax;
|
||||
void* ecx;
|
||||
void* edx;
|
||||
void* efl;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user