Advertisement
danpalol

ottavoesercizio.c

Oct 26th, 2016
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <unistd.h>
  4. #include <signal.h>
  5. void catched(int signo);
  6. int main (){
  7. pid_t pid;
  8. pid=fork();
  9. if (pid==0) { signal(SIGUSR1,catched);
  10. pause();
  11. }
  12. else {
  13. sleep(1);
  14.  
  15. kill(pid,SIGUSR1);
  16.  
  17. }
  18. }
  19.  
  20.  
  21. void catched(int signo){
  22. if(signo== SIGUSR1) {printf("\nlool\n"); exit(0);}
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement