diff options
author | grog <grog@FreeBSD.org> | 2007-03-04 23:42:58 +0000 |
---|---|---|
committer | grog <grog@FreeBSD.org> | 2007-03-04 23:42:58 +0000 |
commit | 3204d2429d804d56b61c26217d002ce687af2fb1 (patch) | |
tree | 2d9f7b0f1df178a2254e925a1eadbbb8f202bd13 /share/man/man9/sleep.9 | |
parent | 65aac5f5dd0252d73f5d27696b6015c355c65659 (diff) | |
download | FreeBSD-src-3204d2429d804d56b61c26217d002ce687af2fb1.zip FreeBSD-src-3204d2429d804d56b61c26217d002ce687af2fb1.tar.gz |
Rearrange function descriptions in more logical order.
Be less alarmist about the dangers of abusing wakeup_one().
Requested by: kris, imp
Diffstat (limited to 'share/man/man9/sleep.9')
-rw-r--r-- | share/man/man9/sleep.9 | 54 |
1 files changed, 30 insertions, 24 deletions
diff --git a/share/man/man9/sleep.9 b/share/man/man9/sleep.9 index 8fd7af0..c9d8a99 100644 --- a/share/man/man9/sleep.9 +++ b/share/man/man9/sleep.9 @@ -87,30 +87,6 @@ Due to the limited space of those programs to display arbitrary strings, this message should not be longer than 6 characters. .Pp The -.Fn wakeup_one -function is used to make the first thread in the queue that is -sleeping on the parameter -.Fa chan -runnable. -This can prevent the system from becoming saturated -when a large number of threads are sleeping on the same address, -but only one of them can actually do any useful work when made -runnable. -.Pp -The -.Fn wakeup_one -function does not work reliably if unrelated threads are sleeping on the same -address. -In this case, if a wakeup for one group of threads is delivered to a member of -another group, that thread will ignore the wakeup, and the correct thread will -never be woken up. -It is the programmer's responsibility to choose a unique -.Fa chan -value. -In case of doubt, do not use -.Fn wakeup_one . -.Pp -The .Fn msleep function is the general sleep call. It suspends the current thread until a wakeup is @@ -212,6 +188,36 @@ The thread can not be awakened early by signals or calls to .Fn wakeup or .Fn wakeup_one . +.Pp +The +.Fn wakeup_one +function makes the first thread in the queue that is sleeping on the +parameter +.Fa chan +runnable. +This reduces the load when a large number of threads are sleeping on +the same address, but only one of them can actually do any useful work +when made runnable. +.Pp +Due to the way it works, the +.Fn wakeup_one +function requires that only related threads sleep on a specific +.Fa chan +address. +It is the programmer's responsibility to choose a unique +.Fa chan +value. +The older +.Fn wakeup +function did not require this, though it was never good practice to for threads to share a +.Fa chan +value. +When converting from +.Fn wakeup +to +.Fn wakeup_one , +pay particular attention to ensure that no other threads wait on the same +.Fa chan . .Sh RETURN VALUES See above. .Sh SEE ALSO |