summaryrefslogtreecommitdiff
path: root/threads.c
diff options
context:
space:
mode:
authorIgor Pashev <pashev.igor@gmail.com>2014-09-02 13:34:01 +0400
committerIgor Pashev <pashev.igor@gmail.com>2014-09-02 13:34:01 +0400
commitfa06cf6edf86aa1839d4f43bfd3bd9a3a36b5223 (patch)
tree705466443ec58fffa74a3499a3bcc56be1cdee9d /threads.c
parent08f466c86ef859f2f3ab1f65677536cbccd85960 (diff)
parent3a8c2d58eab0410fe5e79a112614aa9be061dc46 (diff)
downloadlibxml2-fa06cf6edf86aa1839d4f43bfd3bd9a3a36b5223.tar.gz
Merge branch 'master' of git://anonscm.debian.org/debian-xml-sgml/libxml2
Conflicts: debian/changelog debian/control debian/rules
Diffstat (limited to 'threads.c')
-rw-r--r--threads.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/threads.c b/threads.c
index f206149..f2f2703 100644
--- a/threads.c
+++ b/threads.c
@@ -146,6 +146,7 @@ struct _xmlRMutex {
static pthread_key_t globalkey;
static pthread_t mainthread;
static pthread_once_t once_control = PTHREAD_ONCE_INIT;
+static pthread_once_t once_control_init = PTHREAD_ONCE_INIT;
static pthread_mutex_t global_init_lock = PTHREAD_MUTEX_INITIALIZER;
#elif defined HAVE_WIN32_THREADS
#if defined(HAVE_COMPILER_TLS)
@@ -251,7 +252,6 @@ xmlMutexLock(xmlMutexPtr tok)
#ifdef DEBUG_THREADS
xmlGenericError(xmlGenericErrorContext,
"xmlMutexLock():BeOS:Couldn't aquire semaphore\n");
- exit();
#endif
}
tok->tid = find_thread(NULL);
@@ -499,7 +499,6 @@ __xmlGlobalInitMutexLock(void)
#ifdef DEBUG_THREADS
xmlGenericError(xmlGenericErrorContext,
"xmlGlobalInitMutexLock():BeOS:Couldn't acquire semaphore\n");
- exit();
#endif
}
#endif
@@ -915,7 +914,7 @@ xmlCleanupThreads(void)
#ifdef HAVE_PTHREAD_H
if ((libxml_is_threaded) && (pthread_key_delete != NULL))
pthread_key_delete(globalkey);
- once_control = PTHREAD_ONCE_INIT;
+ once_control = once_control_init;
#elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
if (globalkey != TLS_OUT_OF_INDEXES) {
xmlGlobalStateCleanupHelperParams *p;
@@ -955,6 +954,7 @@ xmlOnceInit(void)
#ifdef HAVE_PTHREAD_H
(void) pthread_key_create(&globalkey, xmlFreeGlobalState);
mainthread = pthread_self();
+ __xmlInitializeDict();
#elif defined(HAVE_WIN32_THREADS)
if (!run_once.done) {
if (InterlockedIncrement(&run_once.control) == 1) {
@@ -962,6 +962,7 @@ xmlOnceInit(void)
globalkey = TlsAlloc();
#endif
mainthread = GetCurrentThreadId();
+ __xmlInitializeDict();
run_once.done = 1;
} else {
/* Another thread is working; give up our slice and
@@ -975,6 +976,7 @@ xmlOnceInit(void)
globalkey = tls_allocate();
tls_set(globalkey, NULL);
mainthread = find_thread(NULL);
+ __xmlInitializeDict();
} else
atomic_add(&run_once_init, -1);
#endif