Skip to content

Commit

Permalink
Updated io.c.
Browse files Browse the repository at this point in the history
  • Loading branch information
ax-6 committed Aug 2, 2024
1 parent a1acfb8 commit b107927
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions aqvm/base/io/io.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@

#include "aqvm/base/file/file.h"

AqvmBaseThreadingMutex_Mutex AqvmBaseIo_printMutex;
AqvmBaseThreadingMutex_Mutex AqvmBaseIo_inputMutex;
AqvmBaseThreadingMutex_Mutex
AqvmBaseIo_outputMutex;

struct AqvmBaseFile_File AqvmBaseIo_stdoutStream;
struct AqvmBaseFile_File* AqvmBaseIo_stdout = &AqvmBaseIo_stdoutStream;
Expand All @@ -26,15 +28,23 @@ int AqvmBaseIo_InitializeIo() {
AqvmBaseIo_stdinStream.file = stdin;
AqvmBaseIo_stderrStream.file = stderr;

if (AqvmBaseThreadingMutex_InitializeMutex(&AqvmBaseIo_printMutex) != 0) {
if (AqvmBaseThreadingMutex_InitializeMutex(&AqvmBaseIo_inputMutex) != 0) {
// TODO
return -1;
}
if (AqvmBaseThreadingMutex_InitializeMutex(&AqvmBaseIo_outputMutex) != 0) {
// TODO
return -2;
}
return 0;
}

int AqvmBaseIo_CloseIo() {
if (AqvmBaseThreadingMutex_CloseMutex(&AqvmBaseIo_printMutex) != 0) {
if (AqvmBaseThreadingMutex_CloseMutex(&AqvmBaseIo_inputMutex) != 0) {
// TODO
return -1;
}
if (AqvmBaseThreadingMutex_CloseMutex(&AqvmBaseIo_outputMutex) != 0) {
// TODO
return -1;
}
Expand Down

0 comments on commit b107927

Please sign in to comment.