delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/01/07/11:02:58

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_YE
X-Spam-Check-By: sourceware.org
X-Mail-Handler: Dyn Standard SMTP by Dyn
X-Report-Abuse-To: abuse AT dyndns DOT com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information)
X-MHO-User: U2FsdGVkX1/JB4yfgD9DOEXvRBWj+0kN
Date: Mon, 7 Jan 2013 11:02:15 -0500
From: Christopher Faylor <cgf-use-the-mailinglist-please AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: pthread_rwlock_tryrdlock bug (with test & patch)
Message-ID: <20130107160215.GA30064@ednor.casa.cgf.cx>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <50E9B35F DOT 7030307 AT iki DOT fi> <20130107064317 DOT GA29248 AT ednor DOT casa DOT cgf DOT cx>
MIME-Version: 1.0
In-Reply-To: <20130107064317.GA29248@ednor.casa.cgf.cx>
User-Agent: Mutt/1.5.20 (2009-06-14)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Mon, Jan 07, 2013 at 01:43:17AM -0500, Christopher Faylor wrote:
>On Sun, Jan 06, 2013 at 06:24:47PM +0100, Antti Kantee wrote:
>>[I'd submit this to cygwin-patches, but the web page says only 
>>subscribers can post to that list, so please bear with me for this 
>>simple issue]
>>
>>Hi,
>>
>>Calling pthread_rwlock_tryrdlock() twice from the same thread always 
>>fails with EBUSY the second time.  See attached test.c.  Replacing the 
>>second tryrdlock() with rdlock() makes the call succeed, leading me to 
>>believe there is a bug in tryrdlock().
>>
>>Assuming I was looking at the correct source file, the attached patch 
>>should fix the issue.  I'm not sure why the lookup_reader() call was 
>>there in the first place; perhaps a remnant from a time when recursive 
>>read locking was not supported?
>>
>>While looking at tryrdlock(), the handling of ULONG_MAX also seems 
>>wrong, as you'd probably want to return EAGAIN instead of allocating 
>>another reader structure.  However, that problem is arguably more of an 
>>academic issue and therefore I didn't touch it in my patch.
>
>Thanks for the analysis and patch.  I've made a few more changes to this
>function and should have everything checked in tomorrow.

This is checked in and will be in the next snapshot at:
http://cygwin.com/snapshots/

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019