also remove pthread key when stopping thread support, patch based on Alex
* threads.c: also remove pthread key when stopping thread
support, patch based on Alex Ott one should fix #564723
daniel
svn path=/trunk/; revision=3810
diff --git a/ChangeLog b/ChangeLog
index b2c0d39..334d848 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Sun Jan 18 16:39:01 CET 2009 Daniel Veillard <daniel@veillard.com>
+
+ * threads.c: also remove pthread key when stopping thread
+ support, patch based on Alex Ott one should fix #564723
+
Sun Jan 18 15:55:18 CET 2009 Daniel Veillard <daniel@veillard.com>
* threads.c: patch from Daniel Zimmermann fixing a memory leak
diff --git a/threads.c b/threads.c
index fde0a62..ef87763 100644
--- a/threads.c
+++ b/threads.c
@@ -63,6 +63,8 @@
extern int pthread_key_create (pthread_key_t *__key,
void (*__destr_function) (void *))
__attribute((weak));
+extern int pthread_key_delete (pthread_key_t __key)
+ __attribute((weak));
extern int pthread_mutex_init ()
__attribute((weak));
extern int pthread_mutex_destroy ()
@@ -83,6 +85,8 @@
__attribute((weak));
extern int pthread_key_create ()
__attribute((weak));
+extern int pthread_key_delete ()
+ __attribute((weak));
extern int pthread_cond_signal ()
__attribute((weak));
#endif
@@ -860,6 +864,7 @@
(pthread_getspecific != NULL) &&
(pthread_setspecific != NULL) &&
(pthread_key_create != NULL) &&
+ (pthread_key_delete != NULL) &&
(pthread_mutex_init != NULL) &&
(pthread_mutex_destroy != NULL) &&
(pthread_mutex_lock != NULL) &&
@@ -913,6 +918,9 @@
globalkey = TLS_OUT_OF_INDEXES;
}
DeleteCriticalSection(&cleanup_helpers_cs);
+#elif defined HAVE_PTHREAD_H
+ if ((pthread_key_delete != NULL) && (globalkey != NULL))
+ pthread_key_delete(globalkey);
#endif
}