X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=TD3%2Fexo4%2Fexo4.c;fp=TD3%2Fexo4%2Fexo4.c;h=e835d0d44505cf72cfdb4acff9d5f8b13d379417;hb=01d700ab53176f4c319136e4ab9023018ffd3721;hp=0000000000000000000000000000000000000000;hpb=4b027192151451c4218def347e9d56e95858bc08;p=TD_SE.git diff --git a/TD3/exo4/exo4.c b/TD3/exo4/exo4.c new file mode 100644 index 0000000..e835d0d --- /dev/null +++ b/TD3/exo4/exo4.c @@ -0,0 +1,42 @@ +#include +#include +#include +#include +#include + +void sigintP() +{ +} + +void sigalrm() +{ +} + +void sigintF() +{ +} + +void sigchld() +{ + int status; + wait(&status); + exit(0); +} + +int main(void) +{ + signal(SIGCHLD, sigchld); + if (fork() == 0) { + signal(SIGINT, sigintF); + while (1) { + printf("ici fils \n"); + sleep(1); + } + } + while (1) { + signal(SIGINT, sigintP); + printf("ici pere \n"); + sleep(1); + } + return 0; +}