.
This commit is contained in:
22
bac2/os/chap1/ex6.c
Normal file
22
bac2/os/chap1/ex6.c
Normal file
@ -0,0 +1,22 @@
|
||||
#include <signal.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
|
||||
void handler(int sig){
|
||||
printf("test");
|
||||
exit(0);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
signal(SIGALRM, handler);
|
||||
|
||||
|
||||
alarm(5);
|
||||
|
||||
getchar();
|
||||
printf("finished without a thing");
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user