Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<sys/types.h>
- #include<sys/wait.h>
- #include<sys/stat.h>
- #include<fcntl.h>
- #include<unistd.h>
- #include<stdio.h>
- #include<stdlib.h>
- #include<signal.h>
- void manejador()
- {
- printf("\nHan pasado 3 segundos, tío");
- }
- int main ()
- {
- struct sigaction act;
- act.sa_handler=manejador;
- sigemptyset(&act.sa_mask);
- sigaddset(&act.sa_mask, SIGINT);
- act.sa_flags=0;
- sigaction(SIGALRM, &act, NULL);
- for ( ; ; )
- {
- alarm(3);
- pause();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement