hw4 test
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user