blob: 0afa71d22b9b3ae30cc8ddb96fe1d1e58465f550 [file] [log] [blame]
rsccfa37a72004-04-10 18:53:55 +00001.TH SLEEP 3
2.SH NAME
3sleep, 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
10int sleep(long millisecs)
11.PP
12.B
13long alarm(unsigned long millisecs)
14.SH DESCRIPTION
15.I Sleep
16suspends the current process for the number
17of milliseconds specified by the argument.
18The actual suspension time may be a little more or less than
19the requested time. If
20.I millisecs
21is 0, the process
22gives up the CPU if another process is waiting to run, returning
23immediately if not.
24Sleep returns \-1 if interrupted, 0 otherwise.
25.PP
26.I Alarm
27causes an
28.B alarm
29note (see
rscbf8a59f2004-04-11 03:42:27 +000030.IR notify (3))
rsccfa37a72004-04-10 18:53:55 +000031to be sent to the invoking process after the number of milliseconds
32given by the argument.
33Successive calls to
34.I alarm
35reset the alarm clock.
36A zero argument clears the alarm.
37The return value is the amount of time previously remaining in
38the alarm clock.
39.SH SOURCE
rscc3674de2005-01-11 17:37:33 +000040.B \*9/src/lib9/sleep.c
rsccfa37a72004-04-10 18:53:55 +000041.SH SEE ALSO
rscbf8a59f2004-04-11 03:42:27 +000042.IR intro (3)
rsccfa37a72004-04-10 18:53:55 +000043.SH DIAGNOSTICS
44These functions set
45.IR errstr .
rscc8b63422005-01-13 04:49:19 +000046.SH BUGS
47To avoid name conflicts with the underlying system,
48.I sleep
49and
50.I alarm
51are preprocessor macros defined as
52.I p9sleep
53and
54.IR p9alarm ;
55see
56.IR intro (3).