1

add semaphore to cga_stream + use it in demos

This commit is contained in:
2022-07-22 18:12:56 +02:00
parent e3dcadcc3c
commit e56e76ea4e
14 changed files with 39 additions and 13 deletions

View File

@ -45,15 +45,22 @@ class CGA_Stream : public OutStream, public CGA {
private:
CGA_Stream(CGA_Stream& copy) = delete; // Verhindere Kopieren
Semaphore sem;
public:
CGA::color color_fg;
CGA::color color_bg;
bool blink;
CGA_Stream() : color_fg(CGA::LIGHT_GREY), color_bg(CGA::BLACK), blink(false) {
CGA_Stream() : sem(1), color_fg(CGA::LIGHT_GREY), color_bg(CGA::BLACK), blink(false) {
flush();
}
void lock() { sem.p(); }
void unlock() { sem.v(); }
// void lock() {}
// void unlock() {}
// Methode zur Ausgabe des Pufferinhalts der Basisklasse StringBuffer.
void flush() override;

View File

@ -71,7 +71,6 @@ inline void PCSPK::delay(int time) {
// systime is incremented in 10ms steps
while ((systime - start_time) * 10 < time) {}
}
/*****************************************************************************