Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-developers-owner AT sources DOT redhat DOT com Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Subject: RE: fix cond_race... was RE: src/winsup/cygwin ChangeLog thread.cc thread.h ... X-MimeOLE: Produced By Microsoft Exchange V6.0.4417.0 Date: Mon, 22 Oct 2001 12:52:14 +1000 Message-ID: X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: fix cond_race... was RE: src/winsup/cygwin ChangeLog thread.cc thread.h ... Thread-Index: AcFaoJuUXbmpuwMOShyGkds2rpP1iwAA+TwA From: "Robert Collins" To: "Jason Tishler" Cc: Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id f9M2iHL23738 right, then try sleep (1) where I have 0 :} > -----Original Message----- > From: Jason Tishler [mailto:jason AT tishler DOT net] > Sent: Monday, October 22, 2001 12:18 PM > To: Robert Collins > Cc: cygwin-developers AT sourceware DOT cygnus DOT com > Subject: Re: fix cond_race... was RE: src/winsup/cygwin ChangeLog > thread.cc thread.h ... > > > Rob, > > On Mon, Oct 22, 2001 at 11:54:39AM +1000, Robert Collins wrote: > > Of course, if python doesn't set thread priority then 3 is unlikely. > > I don't know, but I found the following tidbit while grep-ing > the Python > code for "priority": > > // Using Sleep(0) can cause a priority inversion. > // Sleep(0) only yields the processor if there's > // another thread of the same priority that's > // ready to run. If a high-priority thread is > // trying to acquire the lock, which is held by > // a low-priority thread, then the low-priority > // thread may never get scheduled and hence never > // free the lock. NT attempts to avoid priority > // inversions by temporarily boosting the priority > // of low-priority runnable threads, but the problem > // can still occur if there's a medium-priority > // thread that's always runnable. If Sleep(1) is used, > // then the thread unconditionally yields the CPU. We > // only do this for the second and subsequent even > // iterations, since a millisecond is a long time to wait > // if the thread can be scheduled in again sooner > // (~100,000 instructions). > // Avoid priority inversion: 0, 1, 0, 1,... > > The above seems to resonant with your possibility #3. > > Jason >