OOStuBS - Technische Informatik II (TI-II)
2.4
|
Extension of Scheduler to support blocking of Threads. Mehr ...
#include <organizer.h>
Öffentliche Methoden | |
Customer * | active () const |
Return the currently active customer. | |
void | block (Waitingroom &waitingroom) |
Block the active customer. | |
bool | kill (Customer &that) |
Kill a customer either waiting, running or ready. | |
void | wakeup (Customer &customer) |
Wake up a customer waiting in a room. | |
![]() | |
void | exit () |
Remove the currently active thread from the queue. | |
void | insert (Thread &that) |
Insert the specified thread into the queue. | |
Scheduler () | |
Default Constructor clearing started flag. | |
void | start () |
Start the scheduling by starting the first thread. | |
void | yield () |
Yield to another ready thread. | |
~Scheduler () | |
Default Denstructor clearing started flag. |
Weitere Geerbte Elemente | |
![]() | |
bool | kill (Thread &that) |
Remove the specified thread from the queue of threads, killing the execution of this thread. | |
void | next () |
helper function stop the execution of the current thread and switch to next one | |
void | reactivate (Thread &unblocked) |
Extension of Scheduler to support blocking of Threads.
The organizer extends the basic round-robin scheduling through a blocking semantics. Extended threads called customers are able to wait for certain operations to finish or may wait if a ressource is unavailable. To support this ressources which might be unavailable inherit from Waitingroom to track and manage individual customers waiting fro their service. The organizer handles the transitions of customer between the states "ready", "running" and "blocked".
Definiert in Zeile 35 der Datei organizer.h.
Customer * Organizer::active | ( | ) | const |
Return the currently active customer.
Erneute Implementation von Scheduler.
Definiert in Zeile 26 der Datei organizer.cc.
void Organizer::block | ( | Waitingroom & | waitingroom | ) |
Block the active customer.
This method puts the currently active customer in the waiting queue of waitingroom. Afterwards the execution switches to the next ready thread.
waitingroom | The room the customer will wait in |
Definiert in Zeile 7 der Datei organizer.cc.
bool Organizer::kill | ( | Customer & | that | ) |
Kill a customer either waiting, running or ready.
This method extends the functionality of Scheduler::kill through the removal of currently waiting customers. Therefore the supplied customer is checked if it is waiting in a room. If this is the case the customer is removed from the waiting queue of this room. Otherwise Scheduler::kill is called.
that | The customer to kill |
Definiert in Zeile 20 der Datei organizer.cc.
void Organizer::wakeup | ( | Customer & | customer | ) |
Wake up a customer waiting in a room.
This method removes the customer from the waitingroom it is waiting in and puts it in the ready queue.
customer | The customer to wake up |
Definiert in Zeile 14 der Datei organizer.cc.