Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Napisz program, który wyśle do siebie sygnał SIGALRM i obsłuży go.
- */
- #include <stdio.h>
- #include <stdlib.h>
- #include <signal.h>
- #include <unistd.h>
- void sigalrm_function(int signum)
- {
- printf("Sygnal SIGALRM wylapany i obsluzony!\n");
- exit(EXIT_SUCCESS);
- }
- int main(void)
- {
- if(signal(SIGALRM, sigalrm_function) == SIG_ERR){
- fprintf(stderr, "Signal error\n");
- return EXIT_FAILURE;
- }
- printf("Sygnal zostanie wyslany za sekunde!\n");
- alarm(1);
- while(1){}
- return EXIT_SUCCESS;
- }
Advertisement
Add Comment
Please, Sign In to add comment