diff options
author | jhb <jhb@FreeBSD.org> | 2008-08-07 20:47:01 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2008-08-07 20:47:01 +0000 |
commit | 97c033161b3dd307765e007a6cb2c7211de57d0f (patch) | |
tree | f390c0936964868db6d8b37a3f8266534c858565 | |
parent | 33d0c4b593f378b812a80a267a106afcc107bdf9 (diff) | |
download | FreeBSD-src-97c033161b3dd307765e007a6cb2c7211de57d0f.zip FreeBSD-src-97c033161b3dd307765e007a6cb2c7211de57d0f.tar.gz |
Document the new return values for sleepq_abort(), sleepq_broadcast(), and
sleepq_signal().
Prodded by: attilio
-rw-r--r-- | share/man/man9/sleepqueue.9 | 21 | ||||
-rw-r--r-- | sys/sys/sleepqueue.h | 6 |
2 files changed, 23 insertions, 4 deletions
diff --git a/share/man/man9/sleepqueue.9 b/share/man/man9/sleepqueue.9 index f0654d5..e2e3a4b 100644 --- a/share/man/man9/sleepqueue.9 +++ b/share/man/man9/sleepqueue.9 @@ -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 diff --git a/sys/sys/sleepqueue.h b/sys/sys/sleepqueue.h index dfd960f..0d1f361 100644 --- a/sys/sys/sleepqueue.h +++ b/sys/sys/sleepqueue.h @@ -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 |