Cleanup of shared memory and semaphores
This commit is contained in:
@@ -89,5 +89,25 @@ int main(int argc, char *argv[])
|
||||
|
||||
}
|
||||
|
||||
shared->quit = 1;
|
||||
|
||||
if (munmap(shared, sizeof(*shared)) == -1) {
|
||||
perror("munmap");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
close(shmfd);
|
||||
|
||||
if (shm_unlink(SHM_NAME) == -1) {
|
||||
perror("shm_unlink");
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
sem_close(sUsedSpace);
|
||||
sem_close(sFreeSpace);
|
||||
|
||||
sem_unlink(SEM_USED_SPACE);
|
||||
sem_unlink(SEM_FREE_SPACE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user