Proper algorithm for return values from sleep

John Baldwin jhb at FreeBSD.org
Fri Feb 27 12:42:21 PST 2004


On Friday 27 February 2004 03:35 pm, Daniel Eischen wrote:
> On Fri, 27 Feb 2004, John Baldwin wrote:
> > As part of my sleep queue work, I found that msleep() and the cv_wait()
> > functions have differing semantics for return vales.  It appears that at
> > least some of the early changes KSE made to msleep() were ported to cv's
> > but not later cleanups.  Specifically, in msleep(), if we are awakened
> > while checking for signals but we didn't find a signal, we prefer a
> > timeout-related return value over a signal-related value.
>
> It doesn't look like kern_thread.c uses any return values from msleep.
> Where else would one look?  I would think that cv's would want to behave
> in the same manner.

Not specific to kern_thread.c, but the values msleep() itself returns to all 
callers.   Compare the implementation of msleep() and cv_timedwait_sig() 
post-sleep queues to see some of the XXX comments and differing code.

-- 
John Baldwin <jhb at FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org


More information about the freebsd-threads mailing list