summaryrefslogtreecommitdiffstats
path: root/share
diff options
context:
space:
mode:
authorjhb <jhb@FreeBSD.org>2006-01-03 17:00:38 +0000
committerjhb <jhb@FreeBSD.org>2006-01-03 17:00:38 +0000
commit834b4a427cf2e688b3e0eebeeaa622477f6bf4c0 (patch)
treed05ea0b2bc872f3a55722524782be1023cadf55c /share
parent9105db3d2726214d0faf593e5669709b899b0caa (diff)
downloadFreeBSD-src-834b4a427cf2e688b3e0eebeeaa622477f6bf4c0.zip
FreeBSD-src-834b4a427cf2e688b3e0eebeeaa622477f6bf4c0.tar.gz
- Don't list sleep() in the NAME section as we haven't had a sleep()
function in years. - Change the 'ident' paramters to 'wchan' to match <sys/systm.h>. - Use 'otherwise' in place of 'else' in one place so that this reads like English rather than C. - Document the new msleep_spin() function. - Add history notes for msleep() and msleep_spin().
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/Makefile1
-rw-r--r--share/man/man9/sleep.949
2 files changed, 41 insertions, 9 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 1bfb27d..bde1629 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -867,6 +867,7 @@ MLINKS+=signal.9 cursig.9 \
signal.9 SIG_STOPSIGMASK.9 \
signal.9 trapsignal.9
MLINKS+=sleep.9 msleep.9 \
+ sleep.9 msleep_spin.9 \
sleep.9 tsleep.9 \
sleep.9 wakeup.9 \
sleep.9 wakeup_one.9
diff --git a/share/man/man9/sleep.9 b/share/man/man9/sleep.9
index 514f72c..aa5d66e 100644
--- a/share/man/man9/sleep.9
+++ b/share/man/man9/sleep.9
@@ -29,8 +29,8 @@
.Os
.Dt SLEEP 9
.Sh NAME
-.Nm sleep ,
.Nm msleep ,
+.Nm msleep_spin ,
.Nm tsleep ,
.Nm wakeup
.Nd wait for events
@@ -39,13 +39,15 @@
.In sys/systm.h
.In sys/proc.h
.Ft int
-.Fn tsleep "void *ident" "int priority" "const char *wmesg" "int timo"
+.Fn tsleep "void *chan" "int priority" "const char *wmesg" "int timo"
.Ft int
-.Fn msleep "void *ident" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo"
+.Fn msleep "void *chan" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo"
+.Ft int
+.Fn msleep_spin "void *chan" "struct mtx *mtx" "const char *wmesg" "int timo"
.Ft void
-.Fn wakeup "void *ident"
+.Fn wakeup "void *chan"
.Ft void
-.Fn wakeup_one "void *ident"
+.Fn wakeup_one "void *chan"
.Sh DESCRIPTION
The functions
.Fn tsleep
@@ -56,11 +58,11 @@ If a process must wait for an
external event, it is put on sleep by
.Fn tsleep .
The parameter
-.Fa ident
+.Fa chan
is an arbitrary address that uniquely identifies the event on which
the process is being asleep.
All processes sleeping on a single
-.Fa ident
+.Fa chan
are woken up later by
.Fn wakeup ,
often called from inside an interrupt routine, to indicate that the
@@ -77,7 +79,7 @@ The
.Fn wakeup_one
function is used to make the first process in the queue that is
sleeping on the parameter
-.Fa ident
+.Fa chan
runnable.
This can prevent the system from becoming saturated
when a large number of processes are sleeping on the same address,
@@ -104,7 +106,7 @@ If
.Fa priority
includes the
.Dv PCATCH
-flag, signals are checked before and after sleeping, else signals are
+flag, signals are checked before and after sleeping, otherwise signals are
not checked.
Returns 0 if awakened,
.Er EWOULDBLOCK
@@ -139,6 +141,27 @@ The mutex is
used to ensure that a condition can be checked atomically, and
that the current process can be suspended without missing a
change to the condition, or an associated wakeup.
+.Pp
+The
+.Fn msleep_spin
+function is another variation on
+.Fn tsleep
+similar to
+.Fn msleep .
+Unlike
+.Fn msleep ,
+this function accepts a spin mutex rather than a default mutex for its
+.Fa mtx
+parameter.
+It is also more limited in that it does not accept a
+.Fa priority
+parameter.
+Thus, it will not change the priority of a sleeping thread,
+and it does not support the
+.Dv PDROP
+and
+.Dv PCATCH
+flags.
.Sh RETURN VALUES
See above.
.Sh SEE ALSO
@@ -155,6 +178,14 @@ The
.Fn tsleep
function appeared in
.Bx 4.4 .
+The
+.Fn msleep
+function appeared in
+.Fx 5.0 ,
+and the
+.Fn msleep_spin
+function appeared in
+.Fx 7.0 .
.Pp
The
.Fn sleep
OpenPOWER on IntegriCloud