rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 1 | .TH SLEEP 3 |
| 2 | .SH NAME |
| 3 | sleep, alarm \- delay, ask for delayed note |
| 4 | .SH SYNOPSIS |
| 5 | .B #include <u.h> |
| 6 | .br |
| 7 | .B #include <libc.h> |
| 8 | .PP |
| 9 | .B |
| 10 | int sleep(long millisecs) |
| 11 | .PP |
| 12 | .B |
| 13 | long alarm(unsigned long millisecs) |
| 14 | .SH DESCRIPTION |
| 15 | .I Sleep |
| 16 | suspends the current process for the number |
| 17 | of milliseconds specified by the argument. |
| 18 | The actual suspension time may be a little more or less than |
| 19 | the requested time. If |
| 20 | .I millisecs |
| 21 | is 0, the process |
| 22 | gives up the CPU if another process is waiting to run, returning |
| 23 | immediately if not. |
| 24 | Sleep returns \-1 if interrupted, 0 otherwise. |
| 25 | .PP |
| 26 | .I Alarm |
| 27 | causes an |
| 28 | .B alarm |
| 29 | note (see |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 30 | .IR notify (3)) |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 31 | to be sent to the invoking process after the number of milliseconds |
| 32 | given by the argument. |
| 33 | Successive calls to |
| 34 | .I alarm |
| 35 | reset the alarm clock. |
| 36 | A zero argument clears the alarm. |
| 37 | The return value is the amount of time previously remaining in |
| 38 | the alarm clock. |
| 39 | .SH SOURCE |
rsc | c3674de | 2005-01-11 17:37:33 +0000 | [diff] [blame] | 40 | .B \*9/src/lib9/sleep.c |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 41 | .SH SEE ALSO |
rsc | bf8a59f | 2004-04-11 03:42:27 +0000 | [diff] [blame] | 42 | .IR intro (3) |
rsc | cfa37a7 | 2004-04-10 18:53:55 +0000 | [diff] [blame] | 43 | .SH DIAGNOSTICS |
| 44 | These functions set |
| 45 | .IR errstr . |
rsc | c8b6342 | 2005-01-13 04:49:19 +0000 | [diff] [blame] | 46 | .SH BUGS |
| 47 | To avoid name conflicts with the underlying system, |
| 48 | .I sleep |
| 49 | and |
| 50 | .I alarm |
| 51 | are preprocessor macros defined as |
| 52 | .I p9sleep |
| 53 | and |
| 54 | .IR p9alarm ; |
| 55 | see |
| 56 | .IR intro (3). |