public inbox for pthreads-win32@sourceware.org
 help / color / mirror / Atom feed
* pthread_key_delete issue
@ 2012-10-23 13:34 Stephane Clairet
  2012-10-23 22:15 ` Ross Johnson
  0 siblings, 1 reply; 2+ messages in thread
From: Stephane Clairet @ 2012-10-23 13:34 UTC (permalink / raw)
  To: pthreads-win32

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: pthread_key_delete issue
  2012-10-23 13:34 pthread_key_delete issue Stephane Clairet
@ 2012-10-23 22:15 ` Ross Johnson
  0 siblings, 0 replies; 2+ messages in thread
From: Ross Johnson @ 2012-10-23 22:15 UTC (permalink / raw)
  To: pthreads-win32

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2012-10-23 22:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-23 13:34 pthread_key_delete issue Stephane Clairet
2012-10-23 22:15 ` Ross Johnson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).