1
Files
lecture-operating-system-de…/c_os/user/CoroutineLoop.cc
2022-05-23 09:12:08 +02:00

34 lines
1.6 KiB
C++
Executable File

/*****************************************************************************
* *
* C O R O U T I N E L O O P *
* *
*---------------------------------------------------------------------------*
* Beschreibung: Loop ist eine Koroutine, die nichts weiter tut als einen *
* Zaehler hochzuzaehlen und diesen auf dem Bildschirm *
* anzuzeigen und dann auf die naechste Korotuine umzu- *
* schalten. *
* *
* Autor: Olaf Spinczyk, TU Dortmund *
*****************************************************************************/
#include "user/CoroutineLoop.h"
#include "kernel/Globals.h"
/*****************************************************************************
* Methode: CoroutineLoop::run *
*---------------------------------------------------------------------------*
* Beschreibung: Einstiegsfunktion der Koroutine. *
*****************************************************************************/
void CoroutineLoop::run() {
/* Hier muss Code eingefuegt werden */
int i = 0;
while (true) {
kout.setpos(0, 20 + this->id);
kout << "Corout[" << this->id << "]: " << i++ << endl;
this->switchToNext();
}
}