1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-25 11:37:56 +00:00

Document the new return values for sleepq_abort(), sleepq_broadcast(), and

sleepq_signal().

Prodded by:	attilio
This commit is contained in:
John Baldwin 2008-08-07 20:47:01 +00:00
parent b3dfe39b3a
commit 2cdcea5ed8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=181390
2 changed files with 23 additions and 4 deletions

View File

@ -51,13 +51,13 @@
.In sys/sleepqueue.h
.Ft void
.Fn init_sleepqueues "void"
.Ft void
.Ft int
.Fn sleepq_abort "struct thread *td"
.Ft void
.Fn sleepq_add "void *wchan" "struct lock_object *lock" "const char *wmesg" "int flags" "int queue"
.Ft struct sleepqueue *
.Fn sleepq_alloc "void"
.Ft void
.Ft int
.Fn sleepq_broadcast "void *wchan" "int flags" "int pri" "int queue"
.Ft int
.Fn sleepq_calc_signal_retval "int sig"
@ -73,7 +73,7 @@
.Fn sleepq_release "void *wchan"
.Ft void
.Fn sleepq_remove "struct thread *td" "void *wchan"
.Ft void
.Ft int
.Fn sleepq_signal "void *wchan" "int flags" "int pri" "int queue"
.Ft void
.Fn sleepq_set_timeout "void *wchan" "int timo"
@ -347,6 +347,21 @@ sufficient.
One possible use is waking up a specific thread from a widely shared sleep
channel.
.Pp
The
.Fn sleepq_abort ,
.Fn sleepq_broadcast ,
and
.Fn sleepq_signal
functions all return a boolean value.
If the return value is true,
then at least one thread was resumed that is currently swapped out.
The caller is responsible for awakening the scheduler process so that the
resumed thread will be swapped back in.
This is done by calling the
.Fn kick_proc0
function after releasing the sleep queue chain lock via a call to
.Fn sleepq_release .
.Pp
The sleep queue interface is currently used to implement the
.Xr sleep 9
and

View File

@ -64,7 +64,11 @@
* sleep can be interrupted by calling sleepq_abort(). A thread can also
* be removed from a specified sleep queue using the sleepq_remove()
* function. Note that the sleep queue chain must first be locked via
* sleepq_lock() when calling sleepq_signal() and sleepq_broadcast().
* sleepq_lock() before calling sleepq_abort(), sleepq_broadcast(), or
* sleepq_signal(). These routines each return a boolean that will be true
* if at least one swapped-out thread was resumed. In that case, the caller
* is responsible for waking up the swapper by calling kick_proc0() after
* releasing the sleep queeu chain lock.
*
* Each thread allocates a sleep queue at thread creation via sleepq_alloc()
* and releases it at thread destruction via sleepq_free(). Note that