7 volatile int ticks
= 0;
8 struct itimerval timert
;
9 struct sigaction timer_action
;
12 void handle_vtalrm(int sig
) {
17 timer_action
.sa_handler
= handle_vtalrm
;
18 sigemptyset(&timer_action
.sa_mask
);
19 timer_action
.sa_flags
= SA_RESTART
;
21 sigaction(SIGVTALRM
, &timer_action
, NULL
);
23 timert
.it_interval
.tv_sec
= timert
.it_value
.tv_sec
= 0;
24 timert
.it_interval
.tv_usec
= timert
.it_value
.tv_usec
= 100;
25 setitimer(ITIMER_VIRTUAL
, &timert
, NULL
);
28 int main(int argc
, char *argv
[]) {