Cleanup of shared memory and semaphores
This commit is contained in:
parent
3af17e0d84
commit
93131dc027
20
supervisor.c
20
supervisor.c
@ -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;
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user