This commit is contained in:
2024-12-30 05:59:42 +08:00
parent bf78b95c9d
commit 72320ede22
42 changed files with 1758 additions and 1556 deletions

View File

@@ -21,34 +21,34 @@
// a console device
class SynchConsoleInput : public CallBackObj {
public:
SynchConsoleInput(char *inputFile); // Initialize the console device
~SynchConsoleInput(); // Deallocate console device
public:
SynchConsoleInput(char* inputFile); // Initialize the console device
~SynchConsoleInput(); // Deallocate console device
char GetChar(); // Read a character, waiting if necessary
private:
ConsoleInput *consoleInput; // the hardware keyboard
Lock *lock; // only one reader at a time
Semaphore *waitFor; // wait for callBack
char GetChar(); // Read a character, waiting if necessary
void CallBack(); // called when a keystroke is available
private:
ConsoleInput* consoleInput; // the hardware keyboard
Lock* lock; // only one reader at a time
Semaphore* waitFor; // wait for callBack
void CallBack(); // called when a keystroke is available
};
class SynchConsoleOutput : public CallBackObj {
public:
SynchConsoleOutput(char *outputFile); // Initialize the console device
~SynchConsoleOutput();
public:
SynchConsoleOutput(char* outputFile); // Initialize the console device
~SynchConsoleOutput();
void PutChar(char ch); // Write a character, waiting if necessary
void PutInt(int value);
private:
ConsoleOutput *consoleOutput;// the hardware display
Lock *lock; // only one writer at a time
Semaphore *waitFor; // wait for callBack
void PutChar(char ch); // Write a character, waiting if necessary
void PutInt(int value);
void CallBack(); // called when more data can be written
private:
ConsoleOutput* consoleOutput;// the hardware display
Lock* lock; // only one writer at a time
Semaphore* waitFor; // wait for callBack
void CallBack(); // called when more data can be written
};
#endif // SYNCHCONSOLE_H