summaryrefslogtreecommitdiffstats
path: root/lib/libthr/thread/thr_spec.c
diff options
context:
space:
mode:
authordes <des@FreeBSD.org>2009-09-25 22:45:59 +0000
committerdes <des@FreeBSD.org>2009-09-25 22:45:59 +0000
commitbf5117185e83a178d672946c3f7053d0ef92be27 (patch)
tree394fcfe01b613c0b5b5edbfc414a17c73481ad5d /lib/libthr/thread/thr_spec.c
parentb79ff8160af6fa640e29ce784e59acd49cd1e7fc (diff)
parent5c2742e3dae3ef549329b770ec44b16ca930dc1f (diff)
downloadFreeBSD-src-bf5117185e83a178d672946c3f7053d0ef92be27.zip
FreeBSD-src-bf5117185e83a178d672946c3f7053d0ef92be27.tar.gz
Sync with head
Diffstat (limited to 'lib/libthr/thread/thr_spec.c')
-rw-r--r--lib/libthr/thread/thr_spec.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/libthr/thread/thr_spec.c b/lib/libthr/thread/thr_spec.c
index 06d1287..0740d6b 100644
--- a/lib/libthr/thread/thr_spec.c
+++ b/lib/libthr/thread/thr_spec.c
@@ -131,9 +131,19 @@ _thread_cleanupspecific(void)
curthread->specific[key].data = NULL;
curthread->specific_data_count--;
}
+ else if (curthread->specific[key].data != NULL) {
+ /*
+ * This can happen if the key is deleted via
+ * pthread_key_delete without first setting the value
+ * to NULL in all threads. POSIX says that the
+ * destructor is not invoked in this case.
+ */
+ curthread->specific[key].data = NULL;
+ curthread->specific_data_count--;
+ }
/*
- * If there is a destructore, call it
+ * If there is a destructor, call it
* with the key table entry unlocked:
*/
if (destructor != NULL) {
OpenPOWER on IntegriCloud