Since __pthread_key_create might be concurrently reallocating the
__pthread_key_destructors array, it's not safe to access it without the
mutex held. Posix explicitly says we are allowed to prefer performance
over error detection.
{
struct __pthread *self;
- if (key < 0 || key >= __pthread_key_count
- || __pthread_key_destructors[key] == PTHREAD_KEY_INVALID)
+ if (key < 0 || key >= __pthread_key_count)
return NULL;
self = _pthread_self ();
{
struct __pthread *self = _pthread_self ();
- if (key < 0 || key >= __pthread_key_count
- || __pthread_key_destructors[key] == PTHREAD_KEY_INVALID)
+ if (key < 0 || key >= __pthread_key_count)
return EINVAL;
if (key >= self->thread_specifics_size)