-
Notifications
You must be signed in to change notification settings - Fork 0
/
unlink_semaphore.c
executable file
·30 lines (27 loc) · 1.4 KB
/
unlink_semaphore.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
/* ************************************************************************** */
/* */
/* ::: :::::::: */
/* unlink_semaphore.c :+: :+: :+: */
/* +:+ +:+ +:+ */
/* By: artainmo <marvin@42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2020/10/26 10:19:39 by artainmo #+# #+# */
/* Updated: 2020/10/26 10:22:01 by artainmo ### ########.fr */
/* */
/* ************************************************************************** */
#include <semaphore.h>
/*
**If creation of semaphore fails (permission denied) it is because the
**semaphore has not been destroyed and the computer keeps it in memory even
**after the program has finished, so the solution is to always unlink and
**close your semaphores or restart computer
**Caution when testing infinite loop and quiting it with control-c,
**you do not unlink the semaphore, thus above error will occur
*/
int main(void)
{
sem_unlink("/write");
sem_unlink("/dead");
sem_unlink("/forks");
sem_unlink("/eat_max");
}