secondary
This commit is contained in:
Binary file not shown.
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user