This is the mail archive of the
pthreads-win32@sourceware.org
mailing list for the pthreas-win32 project.
pthread_key_delete issue
- From: Stephane Clairet <Stephane dot Clairet at 4d dot com>
- To: "pthreads-win32 at sourceware dot org" <pthreads-win32 at sourceware dot org>
- Date: Tue, 23 Oct 2012 15:29:52 +0200
- Subject: pthread_key_delete issue
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