summaryrefslogtreecommitdiff
path: root/sysdeps/hurd/pt-key-delete.c
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/hurd/pt-key-delete.c')
-rw-r--r--sysdeps/hurd/pt-key-delete.c19
1 files changed, 19 insertions, 0 deletions
diff --git a/sysdeps/hurd/pt-key-delete.c b/sysdeps/hurd/pt-key-delete.c
index 2426bb1..9d88647 100644
--- a/sysdeps/hurd/pt-key-delete.c
+++ b/sysdeps/hurd/pt-key-delete.c
@@ -35,8 +35,27 @@ pthread_key_delete (pthread_key_t key)
err = EINVAL;
else
{
+ int i;
+
__pthread_key_destructors[key] = PTHREAD_KEY_INVALID;
__pthread_key_invalid_count ++;
+
+ pthread_rwlock_rdlock (&__pthread_threads_lock);
+ for (i = 0; i < __pthread_num_threads; ++i)
+ {
+ struct __pthread *t;
+
+ t = __pthread_threads[i];
+
+ if (t == NULL)
+ continue;
+
+ /* Just remove the key, no need to care whether it was
+ already there. */
+ if (t->thread_specifics)
+ hurd_ihash_remove (t->thread_specifics, key);
+ }
+ pthread_rwlock_unlock (&__pthread_threads_lock);
}
__pthread_mutex_unlock (&__pthread_key_lock);