annotate Gui/timer.c @ 3816:57221064b0b7

nuppelvideo added to supported formats
author gabucino
date Thu, 27 Dec 2001 23:55:34 +0000
parents d237c5d4b216
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
1693
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
1
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
2 #include <signal.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
3 #include <time.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
4 #include <sys/time.h>
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
5
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
6 #include "timer.h"
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
7
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
8 static struct itimerval it;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
9 static struct sigaction sa;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
10
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
11 timerTSigHandler timerSigHandler;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
12
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
13 void timerSetHandler( timerTSigHandler handler )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
14 { timerSigHandler=handler; }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
15
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
16 void timerInit( void )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
17 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
18 sa.sa_handler=timerSigHandler;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
19 sa.sa_flags=SA_RESTART;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
20 sigemptyset( &sa.sa_mask );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
21 sigaction( SIGALRM,&sa,NULL );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
22 it.it_interval.tv_sec=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
23 it.it_interval.tv_usec=20000;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
24 it.it_value.tv_sec=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
25 it.it_value.tv_usec=50000;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
26 setitimer( ITIMER_REAL,&it,NULL );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
27 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
28
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
29 void timerDone( void )
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
30 {
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
31 it.it_interval.tv_sec=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
32 it.it_interval.tv_usec=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
33 it.it_value.tv_sec=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
34 it.it_value.tv_usec=0;
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
35 setitimer( ITIMER_REAL,&it,NULL );
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
36 }
d237c5d4b216 GUI version n-1
arpi
parents:
diff changeset
37