1b6b029e40
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@40 c046a42c-6fe2-441c-8c8c-71466251a162
25 lines
418 B
C
25 lines
418 B
C
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <signal.h>
|
|
#include <unistd.h>
|
|
|
|
void alarm_handler(int sig)
|
|
{
|
|
printf("alarm signal=%d\n", sig);
|
|
alarm(1);
|
|
}
|
|
|
|
int main(int argc, char **argv)
|
|
{
|
|
struct sigaction act;
|
|
act.sa_handler = alarm_handler;
|
|
sigemptyset(&act.sa_mask);
|
|
act.sa_flags = 0;
|
|
sigaction(SIGALRM, &act, NULL);
|
|
alarm(1);
|
|
for(;;) {
|
|
sleep(1);
|
|
}
|
|
return 0;
|
|
}
|