__xmlGlobalInitMutexDestroy() will free global_init_lock on Win32. Patch
* globals.c threads.c include/libxml/threads.h:
__xmlGlobalInitMutexDestroy() will free global_init_lock on Win32.
Patch from Marc-Antoine Ruel.
svn path=/trunk/; revision=3664
diff --git a/threads.c b/threads.c
index 0ab9e77..08c5ba3 100644
--- a/threads.c
+++ b/threads.c
@@ -451,6 +451,7 @@
* section in the global_init_lock then discard the one
* allocated by this thread. */
if (global_init_lock != cs) {
+ DeleteCriticalSection(cs);
free(cs);
}
}
@@ -500,6 +501,24 @@
#endif
}
+/**
+ * xmlGlobalInitMutexDestroy
+ *
+ * Makes sure that the global initialization mutex is destroyed before
+ * application termination.
+ */
+void __xmlGlobalInitMutexDestroy(void)
+{
+#if defined HAVE_WIN32_THREADS
+ if (global_init_lock != NULL)
+ {
+ DeleteCriticalSection(global_init_lock);
+ free(global_init_lock);
+ global_init_lock = NULL;
+ }
+#endif
+}
+
/************************************************************************
* *
* Per thread global state handling *