repositories
/
TD_SE.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
blame
|
history
|
raw
|
HEAD
Add philosophe course code without famine, fixed.
[TD_SE.git]
/
TD3
/
exo4
/
exo4.c
1
#include <unistd.h>
2
#include <signal.h>
3
#include <wait.h>
4
#include <stdio.h>
5
#include <stdlib.h>
6
7
void
sigintP
()
8
{
9
}
10
11
void
sigalrm
()
12
{
13
}
14
15
void
sigintF
()
16
{
17
}
18
19
void
sigchld
()
20
{
21
int
status
;
22
wait
(&
status
);
23
exit
(
0
);
24
}
25
26
int
main
(
void
)
27
{
28
signal
(
SIGCHLD
,
sigchld
);
29
if
(
fork
() ==
0
) {
30
signal
(
SIGINT
,
sigintF
);
31
while
(
1
) {
32
printf
(
"ici fils
\n
"
);
33
sleep
(
1
);
34
}
35
}
36
while
(
1
) {
37
signal
(
SIGINT
,
sigintP
);
38
printf
(
"ici pere
\n
"
);
39
sleep
(
1
);
40
}
41
return
0
;
42
}