diff options
author | Michael I. Bushnell <mib@gnu.org> | 1994-05-04 17:59:11 +0000 |
---|---|---|
committer | Michael I. Bushnell <mib@gnu.org> | 1994-05-04 17:59:11 +0000 |
commit | 89a3b2fabd2e5727687c714e9e9669ac089965d4 (patch) | |
tree | ca2500f73d91ea25b7ad6ef42c3119e960b04452 | |
parent | cfe3c52731bf64bcc264ef2abccea457896563de (diff) |
Formerly timertest.c.~2~
-rw-r--r-- | fstests/timertest.c | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/fstests/timertest.c b/fstests/timertest.c index db19f4d6..9f3ae74f 100644 --- a/fstests/timertest.c +++ b/fstests/timertest.c @@ -15,18 +15,21 @@ along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +#include <signal.h> +#include <sys/time.h> +#include <stdio.h> -int -alarm_handler () +void +alarm_handler (int signo) { printf ("Received alarm\n"); fflush (stdout); } +int main() { struct itimerval real_timer; - error_t err; real_timer.it_interval.tv_usec = 0; real_timer.it_interval.tv_sec = 1; @@ -35,8 +38,12 @@ main() signal (SIGALRM, alarm_handler); - err = setitimer (ITIMER_REAL, &real_timer, 0); - + if (setitimer (ITIMER_REAL, &real_timer, 0) < 0) + { + perror ("Setting timer"); + exit (1); + } + while (1) { printf ("Pausing\n"); |