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

@@ -17,7 +17,7 @@
// otherwise, read from this file
//----------------------------------------------------------------------
SynchConsoleInput::SynchConsoleInput(char *inputFile)
SynchConsoleInput::SynchConsoleInput(char* inputFile)
{
consoleInput = new ConsoleInput(inputFile, this);
lock = new Lock("console in");
@@ -30,9 +30,9 @@ SynchConsoleInput::SynchConsoleInput(char *inputFile)
//----------------------------------------------------------------------
SynchConsoleInput::~SynchConsoleInput()
{
delete consoleInput;
delete lock;
{
delete consoleInput;
delete lock;
delete waitFor;
}
@@ -73,7 +73,7 @@ SynchConsoleInput::CallBack()
// otherwise, read from this file
//----------------------------------------------------------------------
SynchConsoleOutput::SynchConsoleOutput(char *outputFile)
SynchConsoleOutput::SynchConsoleOutput(char* outputFile)
{
consoleOutput = new ConsoleOutput(outputFile, this);
lock = new Lock("console out");
@@ -86,9 +86,9 @@ SynchConsoleOutput::SynchConsoleOutput(char *outputFile)
//----------------------------------------------------------------------
SynchConsoleOutput::~SynchConsoleOutput()
{
delete consoleOutput;
delete lock;
{
delete consoleOutput;
delete lock;
delete waitFor;
}
@@ -106,13 +106,18 @@ SynchConsoleOutput::PutChar(char ch)
lock->Release();
}
//----------------------------------------------------------------------
// SynchConsoleOutput::PutInt
// Write a int to the console display, waiting if necessary.
//----------------------------------------------------------------------
void
SynchConsoleOutput::PutInt(int value)
{
lock->Acquire();
consoleOutput->PutInt(value);
waitFor->P();
lock->Release();
lock->Acquire();
consoleOutput->PutInt(value);
waitFor->P();
lock->Release();
}
//----------------------------------------------------------------------