aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorJohn Baldwin <jhb@FreeBSD.org>2007-02-23 16:22:09 +0000
committerJohn Baldwin <jhb@FreeBSD.org>2007-02-23 16:22:09 +0000
commit37e80fcac22c6734bcdb79e160bc1eac56740c4c (patch)
treec39c70c56ffcacc39b3ae90078a8abf26cbf23c3 /share
parent80b7fd0f47a12ec52808a93b911d8a3324c0acb9 (diff)
downloadsrc-37e80fcac22c6734bcdb79e160bc1eac56740c4c.tar.gz
src-37e80fcac22c6734bcdb79e160bc1eac56740c4c.zip
Add a new kernel sleep function pause(9). pause(9) is for places that
want an equivalent of DELAY(9) that sleeps instead of spins. It accepts a wmesg and a timeout and is not interrupted by signals. It uses a private wait channel that should never be woken up by wakeup(9) or wakeup_one(9). Glanced at by: phk
Notes
Notes: svn path=/head/; revision=166908
Diffstat (limited to 'share')
-rw-r--r--share/man/man9/Makefile1
-rw-r--r--share/man/man9/sleep.927
2 files changed, 24 insertions, 4 deletions
diff --git a/share/man/man9/Makefile b/share/man/man9/Makefile
index 2298e39b8a04..64c11abf85f9 100644
--- a/share/man/man9/Makefile
+++ b/share/man/man9/Makefile
@@ -997,6 +997,7 @@ MLINKS+=signal.9 cursig.9 \
signal.9 trapsignal.9
MLINKS+=sleep.9 msleep.9 \
sleep.9 msleep_spin.9 \
+ sleep.9 pause.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 db97565b74d5..0973fc5019ce 100644
--- a/share/man/man9/sleep.9
+++ b/share/man/man9/sleep.9
@@ -31,6 +31,7 @@
.Sh NAME
.Nm msleep ,
.Nm msleep_spin ,
+.Nm pause ,
.Nm tsleep ,
.Nm wakeup
.Nd wait for events
@@ -39,12 +40,14 @@
.In sys/systm.h
.In sys/proc.h
.Ft int
-.Fn tsleep "void *chan" "int priority" "const char *wmesg" "int timo"
-.Ft int
.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 pause "const char *wmesg" "int timo"
+.Ft int
+.Fn tsleep "void *chan" "int priority" "const char *wmesg" "int timo"
+.Ft void
.Fn wakeup "void *chan"
.Ft void
.Fn wakeup_one "void *chan"
@@ -53,6 +56,7 @@ The functions
.Fn tsleep ,
.Fn msleep ,
.Fn msleep_spin ,
+.Fn pause ,
.Fn wakeup ,
and
.Fn wakeup_one
@@ -61,12 +65,13 @@ If a thread must wait for an
external event, it is put to sleep by
.Fn tsleep ,
.Fn msleep ,
+.Fn msleep_spin ,
or
-.Fn msleep_spin .
+.Fn pause .
The parameter
.Fa chan
is an arbitrary address that uniquely identifies the event on which
-the thread is being asleep.
+the thread is being put to sleep.
All threads sleeping on a single
.Fa chan
are woken up later by
@@ -184,6 +189,16 @@ and it does not support the
and
.Dv PCATCH
flags.
+.Pp
+The
+.Fn pause
+function is a wrapper around
+.Fn tsleep
+that suspends execution of the current thread for the indicated timeout.
+The thread can not be awakened early by signals or calls to
+.Fn wakeup
+or
+.Fn wakeup_one.
.Sh RETURN VALUES
See above.
.Sh SEE ALSO
@@ -211,6 +226,10 @@ function appeared in
and the
.Fn msleep_spin
function appeared in
+.Fx 6.2 .
+.The
+.Fn pause
+function appeared in
.Fx 7.0 .
.Pp
The