Additional bug in _POSIX_Keys_Run_destructors()?

Phil Torre ptorre at
Fri Nov 2 21:38:26 UTC 2007

On Fri 02-Nov-07 6:55 AM, Joel Sherrill wrote:
> Phil Torre wrote:
>> Hi Joel,
>> Last week you clued me in to a patch that I was missing in my outdated
>> 4.6.0-derived source tree.  (Specifically, pthread_getspecific() was
>> indexing into the key values with key->Values[class] instead of
>> key->Values[api].)  I applied that patch and things are working well.
>> I started looking around, and I see what may be the same bug in another
>> place; this time it's _POSIX_Keys_Run_destructors().  That function is
>> also indexing into the Values array using class rather than API.  I
>> looked at your current CVS version and it's doing the same thing.
>> Is this a bug that got missed when the previous one was patched?
> Looks like it to me.  Attached is a patch.  Does it look OK to you?

Yep, looks fine.

> FWIW keys have an issue when the number of threads is
> configured as unlimited.  A while back, I suggested going to
> a hash map for thread keys but never got anywhere with it.

I was wondering what would happen if more threads were allocated after
a key had been created.  I'll add that to my list of things to watch
out for...


More information about the users mailing list