Add TD3 code.
[TD_SE.git] / TD3 / exo4 / exo4.c
CommitLineData
01d700ab
JB
1#include <unistd.h>
2#include <signal.h>
3#include <wait.h>
4#include <stdio.h>
5#include <stdlib.h>
6
7void sigintP()
8{
9}
10
11void sigalrm()
12{
13}
14
15void sigintF()
16{
17}
18
19void sigchld()
20{
21 int status;
22 wait(&status);
23 exit(0);
24}
25
26int 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}