kse_release and kse_wakeup problem (fwd)

John Baldwin jhb at FreeBSD.org
Tue Apr 27 06:47:11 PDT 2004


On Monday 26 April 2004 08:41 am, David Xu wrote:
> I think libthr will encounters same problem as libpthread with new sleep
> queue code, because mtx is released too early in msleep before thread
> markes itself as ON_SLEEPQ, thr_suspend and thr_wakeup have same race
> window as kse_release and kse_wakeup. Any code wants to put synchronous
> bit in td_flags like these codes will be broken.

Nope.  libthr msleep's on PROC_LOCK.  It can do this because it holds both 
sched_lock and proc_lock when writing to its thread flag, so it can hold just 
the proc_lock for reading the flag, including msleep/wakeup.

-- 
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