aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--threads.c8
2 files changed, 13 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index b2c0d39a..334d8485 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 fde0a62b..ef87763a 100644
--- a/threads.c
+++ b/threads.c
@@ -63,6 +63,8 @@ extern int pthread_setspecific (pthread_key_t __key,
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 @@ extern pthread_t pthread_self ()
__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 @@ xmlInitThreads(void)
(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 @@ xmlCleanupThreads(void)
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
}