Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 27 Apr 2004 09:43:56 -0400
From:      John Baldwin <jhb@FreeBSD.org>
To:        David Xu <davidxu@FreeBSD.org>
Cc:        threads@FreeBSD.org
Subject:   Re: kse_release and kse_wakeup problem (fwd)
Message-ID:  <200404270943.56789.jhb@FreeBSD.org>
In-Reply-To: <408D0373.8050006@freebsd.org>
References:  <Pine.GSO.4.10.10404221759560.15790-100000@pcnet5.pcnet.com> <200404231357.23096.jhb@FreeBSD.org> <408D0373.8050006@freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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@FreeBSD.org>  <><  http://www.FreeBSD.org/~jhb/
"Power Users Use the Power to Serve"  =  http://www.FreeBSD.org



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200404270943.56789.jhb>