From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 7514 invoked by alias); 23 Oct 2012 22:15:10 -0000 Received: (qmail 7502 invoked by uid 22791); 23 Oct 2012 22:15:08 -0000 X-SWARE-Spam-Status: No, hits=-1.9 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED,RCVD_IN_DNSWL_NONE,RCVD_IN_HOSTKARMA_NO,RCVD_IN_HOSTKARMA_YE,RCVD_IN_NIX_SPAM,RCVD_VIA_APNIC X-Spam-Check-By: sourceware.org Received: from icp-osb-irony-out9.external.iinet.net.au (HELO icp-osb-irony-out9.external.iinet.net.au) (203.59.1.226) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 23 Oct 2012 22:15:03 +0000 X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: Av8EAPgVh1DKN5wC/2dsb2JhbABEwX+BCIIeAQEFJwsBBREKJRELDQsJFg8JAwIBAgFFEwYCAQGHfwy7IotggzuDIwOXCYRvgzuGeIMDgU8 Received: from unknown (HELO mail01.grapevine.net.au) ([202.55.156.2]) by icp-osb-irony-out9.iinet.net.au with ESMTP; 24 Oct 2012 06:15:01 +0800 Received: from ppp-39-48.grapevine.net.au ([203.129.39.48] helo=[192.168.2.2]) by mail01.grapevine.net.au with esmtp (Exim 4.77) (envelope-from ) id 1TQmkW-0001te-LS for pthreads-win32@sourceware.org; Wed, 24 Oct 2012 09:15:00 +1100 Message-ID: <508716E3.7000900@homemail.com.au> Date: Tue, 23 Oct 2012 22:15:00 -0000 From: Ross Johnson User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:16.0) Gecko/20121010 Thunderbird/16.0.1 MIME-Version: 1.0 To: pthreads-win32@sourceware.org Subject: Re: pthread_key_delete issue References: <73C0C0720B9162459C8AF58ED19AD5B65D741FC96F@4d-xn1-exch> In-Reply-To: <73C0C0720B9162459C8AF58ED19AD5B65D741FC96F@4d-xn1-exch> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Mailing-List: contact pthreads-win32-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: pthreads-win32-owner@sourceware.org X-SW-Source: 2012/txt/msg00028.txt.bz2 Hi Stéphane, Thank you for reporting and fixing this. The error was indeed introduced after 2.8.0, i.e. when I changed to use MCS locks in this part of the code. There will be a new test also for this to make sure it doesn't regress again. I will update the CVS repository on sourceware.org soon and a little earlier to the Git repository at: http://sourceforge.net/projects/pthreads4w/ Regards. Ross On 24/10/2012 12:29 AM, Stephane Clairet wrote: > Hi, > after migrating from 2.8.0 version to 2.9.1 version, I have an issue with pthread_key_delete function. > Sometimes, the application on which I work freezes after calling pthread_key_delete. > > In fact, the app is stopped on this line: ptw32_mcs_lock_release (&keyLock) (line 106 into pthread_key_delete.c file) > It seems to be reproduced only when the specific data key concerns several threads. > The explanation is maybe inside the pthread_key_delete implementation: > > int pthread_key_delete (pthread_key_t key) > { > ptw32_mcs_lock_acquire (&(key->keyLock), &keyLock); > ... > while ((assoc = (ThreadKeyAssoc *) key->threads) != NULL) > { > ... > ptw32_mcs_lock_release (&keyLock); > } > } > > The freeze always occurs when the program try to release the key lock a second time. I don't know if it's supposed to be supported. > Release the key lock outside the while loop seems to fix the issue. > > Thanks for help. > Regards. > > Stéphane > > > > > Stephane Clairet > Architecte Logiciel > > 4D SAS > 60, rue d'Alsace > 92110 Clichy > France > > Standard : +33 1 40 87 92 00 > Email : Stephane.Clairet@4d.com > Web : www.4D.com > >