diff options
author | davidxu <davidxu@FreeBSD.org> | 2009-09-25 00:15:30 +0000 |
---|---|---|
committer | davidxu <davidxu@FreeBSD.org> | 2009-09-25 00:15:30 +0000 |
commit | d9aeefb9cee39a65606a4894995fec0cf59ab6bf (patch) | |
tree | 668a56cd9a866868d608a2fb8adc563865438312 /lib | |
parent | 14cbd7c194c8b2d03562e97e659e4bd3b971fbb9 (diff) | |
download | FreeBSD-src-d9aeefb9cee39a65606a4894995fec0cf59ab6bf.zip FreeBSD-src-d9aeefb9cee39a65606a4894995fec0cf59ab6bf.tar.gz |
don't report error if key was deleted.
PR: threads/135462
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libthr/thread/thr_spec.c | 12 |
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) { |