Proper algorithm for return values from sleep

David Xu davidxu at freebsd.org
Fri Feb 27 17:28:58 PST 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.

Yes, I think cv and msleep code should be synchronized.

> Secondly, cv's don't really handle 
> td_intrval very well at all.
It is a bug. :-(

> It has one hard-coded override for the P_EXIT 
> case but that's it.
> 
I think it should includes P_SINGLE_EXIT, P_WEXIT is set when there is
only one thread in process (see exit1() ). both msleep and cv are
incorrect in the case.

Are you fixing these bugs ?

David Xu




More information about the freebsd-threads mailing list