1: #include <signal.h>
   2: 
   3: static  ringring;
   4: 
   5: sleep(n)
   6: unsigned n;
   7: {
   8:     int sleepx();
   9:     unsigned altime;
  10:     int (*alsig)() = SIG_DFL;
  11: 
  12:     if (n==0)
  13:         return;
  14:     altime = alarm(1000);   /* time to maneuver */
  15:     if (altime) {
  16:         if (altime > n)
  17:             altime -= n;
  18:         else {
  19:             n = altime;
  20:             altime = 1;
  21:         }
  22:     }
  23:     alsig = sigset(SIGALRM, sleepx);
  24:     alarm(n);
  25:     for(;;) {
  26:         pause();
  27:         if (ringring) {
  28:             sigset(SIGALRM, alsig);
  29:             alarm(altime);
  30:             ringring = 0;
  31:             return;
  32:         }
  33:     }
  34:     /*NOTREACHED*/
  35: }
  36: 
  37: static
  38: sleepx()
  39: {
  40:     ringring = 1;
  41: }

Defined functions

sleep defined in line 5; never used
sleepx defined in line 37; used 2 times
  • in line 8, 23
Last modified: 1983-07-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 659
Valid CSS Valid XHTML 1.0 Strict