Utah Raster Toolkit  9999-git
URT Development version (post-3.1b)
Macros | Functions | Variables
timer.c File Reference
#include <stdlib.h>
#include <string.h>
#include <signal.h>
#include <sys/time.h>
#include "rle_config.h"
Include dependency graph for timer.c:

Go to the source code of this file.

Macros

#define USPS   1000000 /* number of microseconds in a second */
 
#define TICK   10000 /* system clock resolution in microseconds */
 

Functions

static void sleepx ()
 
void set_timer (unsigned n)
 
void wait_timer ()
 

Variables

static char rcsid [] = "$Header: /l/spencer/src/urt/get/getx11/RCS/timer.c,v 3.0.1.3 1992/03/04 19:31:40 spencer Exp $"
 
static int ringring
 
static void(* ofunc )()
 

Macro Definition Documentation

#define TICK   10000 /* system clock resolution in microseconds */

Definition at line 32 of file timer.c.

#define USPS   1000000 /* number of microseconds in a second */

Definition at line 31 of file timer.c.

Function Documentation

void set_timer ( unsigned  n)

Definition at line 46 of file timer.c.

48 {
49 #ifndef NO_ITIMER
50  struct itimerval itv;
51  register struct itimerval *itp = &itv;
52  if (n == 0)
53  {
54  ringring = 1;
55  return;
56  }
57  timerclear(&itp->it_interval);
58  itp->it_value.tv_sec = n / USPS;
59  itp->it_value.tv_usec = n % USPS;
60  ofunc = (void (*)())signal(SIGALRM, sleepx);
61 
62  ringring = 0;
63  (void) setitimer(ITIMER_REAL, itp, (struct itimerval *)0);
64 #endif
65 }
static void(* ofunc)()
Definition: timer.c:36
#define USPS
Definition: timer.c:31
static int ringring
Definition: timer.c:35
static void sleepx()
Definition: timer.c:39
static void sleepx ( )
static

Definition at line 39 of file timer.c.

References ringring.

40 {
41  ringring = 1;
42 }
static int ringring
Definition: timer.c:35
void wait_timer ( void  )

Definition at line 72 of file timer.c.

References ofunc, and ringring.

73 {
74 #ifndef NO_ITIMER
75  while (!ringring)
76  sigpause( ~sigmask(SIGALRM));
77  signal(SIGALRM, ofunc);
78 #endif
79 }
static void(* ofunc)()
Definition: timer.c:36
static int ringring
Definition: timer.c:35

Variable Documentation

void(* ofunc) ()
static

Definition at line 36 of file timer.c.

Referenced by wait_timer().

char rcsid[] = "$Header: /l/spencer/src/urt/get/getx11/RCS/timer.c,v 3.0.1.3 1992/03/04 19:31:40 spencer Exp $"
static

Definition at line 22 of file timer.c.

int ringring
static

Definition at line 35 of file timer.c.

Referenced by sleepx(), and wait_timer().