Hi! On Wed, 2 Nov 2011 18:03:04 +0100, Pino Toscano <toscano.p...@tiscali.it> wrote: > as I found few months ago[1], when calling pthread_key_delete() all its > values in threads are not removed; this, plus the the fact that deleted > keys can be reused in pthread_key_create(), causes that in some > occasions (i.e. when a new key is actually a reused one) there are the > old thread specific data still available in threads which previously set > some using the key prior of being deleted and reused again. > > Attached there is a patch fixing this behaviour by cleaning up all the > values of the key being deleted. It includes also a small test case. > > [1] > http://www.gnu.org/software/hurd/open_issues/libpthread_pthread_key_create_reuse.html > > -- > Pino Toscano > From 557337b9348f29b29acb4b226fd8ffddf5f22d30 Mon Sep 17 00:00:00 2001 > From: Pino Toscano <toscano.p...@tiscali.it> > Date: Wed, 2 Nov 2011 17:38:46 +0100 > Subject: [PATCH] Remove all the values when deleting a key > > When deleting a key using `pthread_key_delete', delete all the values > associated to that key in all the threads available. Otherwise, the > key reuse in `pthread_key_create' can cause new keys to have thread > specific data of the previously used key with the same index. > > Add a test for this case, which creates and deletes pairs of keys > checking that they have a NULL thread specific data after creation. > > * sysdeps/hurd/pt-key-delete.c (pthread_key_delete): Remove all the > values of the key in all the threads. > > * tests/Makefile (CHECK_SRC): Add test-17.c. > * tests/test-17.c: New file.
This does look correct to me, but I'm by no means a pthread implementation expert. Neal, can you comment? Grüße, Thomas
pgpCqqk7wDN1l.pgp
Description: PGP signature