2 .\" Copyright (c) 1996 Joerg Wunsch
4 .\" All rights reserved.
6 .\" Redistribution and use in source and binary forms, with or without
7 .\" modification, are permitted provided that the following conditions
9 .\" 1. Redistributions of source code must retain the above copyright
10 .\" notice, this list of conditions and the following disclaimer.
11 .\" 2. Redistributions in binary form must reproduce the above copyright
12 .\" notice, this list of conditions and the following disclaimer in the
13 .\" documentation and/or other materials provided with the distribution.
15 .\" THIS SOFTWARE IS PROVIDED BY THE DEVELOPERS ``AS IS'' AND ANY EXPRESS OR
16 .\" IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
17 .\" OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
18 .\" IN NO EVENT SHALL THE DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT,
19 .\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 .\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21 .\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22 .\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 .\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 .\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
42 .Fn tsleep "void *chan" "int priority" "const char *wmesg" "int timo"
44 .Fn msleep "void *chan" "struct mtx *mtx" "int priority" "const char *wmesg" "int timo"
46 .Fn msleep_spin "void *chan" "struct mtx *mtx" "const char *wmesg" "int timo"
48 .Fn wakeup "void *chan"
50 .Fn wakeup_one "void *chan"
59 handle event-based thread blocking.
60 If a thread must wait for an
61 external event, it is put to sleep by
68 is an arbitrary address that uniquely identifies the event on which
69 the thread is being asleep.
70 All threads sleeping on a single
74 often called from inside an interrupt routine, to indicate that the
75 resource the thread was blocking on is available now.
79 is a string describing the sleep condition for tools like
81 Due to the limited space of those programs to display arbitrary strings,
82 this message should not be longer than 6 characters.
86 function is used to make the first thread in the queue that is
87 sleeping on the parameter
90 This can prevent the system from becoming saturated
91 when a large number of threads are sleeping on the same address,
92 but only one of them can actually do any useful work when made
97 function is the general sleep call.
98 It suspends the current thread until a wakeup is
99 performed on the specified identifier.
102 parameter is a mutex which will be released before sleeping and reacquired
112 parameter will not be reacquired before returning.
113 The mutex is used to ensure that a condition can be checked atomically,
114 and that the current thread can be suspended without missing a
115 change to the condition, or an associated wakeup.
119 then the thread will be made
120 runnable with the specified
126 then the thread will sleep for at most
142 flag, signals are checked before and after sleeping, otherwise signals are
146 function returns 0 if awakened,
148 if the timeout expires.
151 is set and a signal needs to be delivered,
153 is returned if the current system call should be restarted if
156 is returned if the system call should be interrupted by the signal
162 function is a variation on
164 It is identical to invoking
173 function is another variation on
175 This function accepts a spin mutex rather than a default mutex for its
178 It is also more limited in that it does not accept a
181 Thus, it will not change the priority of a sleeping thread,
182 and it does not support the
194 The sleep/wakeup thread synchronization mechanism is very old.
196 appeared in a very early version of
218 function used to be the traditional form.
219 It did not let you specify a timeout or a
221 hence it was discontinued.
224 This manual page was written by
225 .An J\(:org Wunsch Aq joerg@FreeBSD.org .