secondary

This commit is contained in:
2025-04-09 15:57:05 +00:00
parent 3895f9a812
commit f735532766
3 changed files with 162 additions and 155 deletions
BIN
View File
Binary file not shown.
+8 -1
View File
@@ -68,7 +68,7 @@ void startThreadOutput(int threadCount) {
for (int i = 0; i < 256; i++) {
char semName[10];
sprintf(semName, "S%d", i);
multiple_semaphores[i] = sem_open(semName, O_CREAT, 777, 1);
multiple_semaphores[i] = sem_open(semName, O_CREAT, 777, 1);
}
}
// Reset the total_random array to 0 before counting
@@ -111,6 +111,13 @@ void startThreadOutput(int threadCount) {
if (modeFlag == 1) {
sem_close(one_semaphore);
sem_unlink("one_semaphore");
} else if (modeFlag == 2) {
for (int i = 0; i < 256; i++) {
char semName[10];
sprintf(semName, "S%d", i);
sem_close(multiple_semaphores[i]);
sem_unlink(semName);
}
}
}