reformat
This commit is contained in:
@ -16,7 +16,6 @@
|
||||
|
||||
#include "kernel/threads/Dispatch.h"
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Methode: Dispatcher::start *
|
||||
*---------------------------------------------------------------------------*
|
||||
@ -25,14 +24,13 @@
|
||||
* Parameter: *
|
||||
* first Zu startender Thread. *
|
||||
*****************************************************************************/
|
||||
void Dispatcher::start (Thread& first) {
|
||||
void Dispatcher::start(Thread& first) {
|
||||
if (!active) {
|
||||
active = &first;
|
||||
active->start ();
|
||||
active->start();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************************
|
||||
* Methode: Dispatcher::dispatch *
|
||||
*---------------------------------------------------------------------------*
|
||||
@ -41,8 +39,8 @@ void Dispatcher::start (Thread& first) {
|
||||
* Parameter: *
|
||||
* next Thread der die CPU erhalten soll. *
|
||||
*****************************************************************************/
|
||||
void Dispatcher::dispatch (Thread& next) {
|
||||
void Dispatcher::dispatch(Thread& next) {
|
||||
Thread* current = active;
|
||||
active = &next;
|
||||
current->switchTo (next);
|
||||
current->switchTo(next);
|
||||
}
|
||||
|
||||
@ -19,17 +19,16 @@
|
||||
#include "kernel/threads/Thread.h"
|
||||
|
||||
class Dispatcher {
|
||||
|
||||
private:
|
||||
Thread* active; // aktiver Thread
|
||||
Thread* active; // aktiver Thread
|
||||
|
||||
Dispatcher(const Dispatcher ©); // Verhindere Kopieren
|
||||
Dispatcher(const Dispatcher& copy) = delete; // Verhindere Kopieren
|
||||
|
||||
public:
|
||||
Dispatcher () : active (0) {}
|
||||
void start (Thread& first);
|
||||
void dispatch (Thread& next);
|
||||
Thread* get_active () { return active; }
|
||||
Dispatcher() : active(0) {}
|
||||
void start(Thread& first);
|
||||
void dispatch(Thread& next);
|
||||
Thread* get_active() { return active; }
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@ -17,30 +17,28 @@
|
||||
#include "lib/Queue.h"
|
||||
|
||||
class Scheduler : public Dispatcher {
|
||||
|
||||
private:
|
||||
Scheduler (const Scheduler ©); // Verhindere Kopieren
|
||||
|
||||
private:
|
||||
Queue readyQueue; // auf die CPU wartende Threads
|
||||
|
||||
Scheduler(const Scheduler& copy) = delete; // Verhindere Kopieren
|
||||
|
||||
Queue readyQueue; // auf die CPU wartende Threads
|
||||
|
||||
public:
|
||||
Scheduler () {}
|
||||
Scheduler() {}
|
||||
|
||||
// Scheduler starten
|
||||
void schedule ();
|
||||
|
||||
void schedule();
|
||||
|
||||
// Thread in readyQueue eintragen
|
||||
void ready (Thread * that);
|
||||
|
||||
void ready(Thread* that);
|
||||
|
||||
// Thread terminiert sich selbst
|
||||
void exit ();
|
||||
void exit();
|
||||
|
||||
// Thread mit 'Gewalt' terminieren
|
||||
void kill (Thread * that);
|
||||
void kill(Thread* that);
|
||||
|
||||
// CPU freiwillig abgeben und Auswahl des naechsten Threads
|
||||
void yield ();
|
||||
void yield();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user