2 * sleep - suspend current process for a number of seconds
4 /* $Id: sleep.c,v 1.4 1994/06/24 11:45:44 ceriel Exp $ */
12 static jmp_buf setjmpbuf;
17 longjmp(setjmpbuf, 1);
18 } /* used with sleep() below */
23 /* sleep(n) pauses for 'n' seconds by scheduling an alarm interrupt. */
24 unsigned oldalarm = 0;
25 void (*oldsig)(int) = 0;
28 if (setjmp(setjmpbuf)) {
29 signal(SIGALRM, oldsig);
33 oldalarm = _alarm(5000); /* Who cares how long, as long
34 * as it is long enough
36 if (oldalarm > n) oldalarm -= n;
41 oldsig = signal(SIGALRM, alfun);
44 /* allow for other handlers ... */