| 1 | From 3f6cfbd1d38d0634a2ddcb9a0a13e1b5a2195a5e Mon Sep 17 00:00:00 2001 |
| 2 | From: Friedrich Haubensak <hsk@fli-leibniz.de> |
| 3 | Date: Wed, 12 Sep 2012 15:34:53 +0000 |
| 4 | Subject: Fix a thread portability problem |
| 5 | |
| 6 | cannot compile libxml2-2.9.0 using studio 12.1 compiler on solaris 10 |
| 7 | |
| 8 | I.M.O. structure initializer (as PTHREAD_ONCE_INIT) cannot be used in |
| 9 | a structure assignment anyway |
| 10 | --- |
| 11 | diff --git a/threads.c b/threads.c |
| 12 | index f206149..7e85a26 100644 |
| 13 | --- a/threads.c |
| 14 | +++ b/threads.c |
| 15 | @@ -146,6 +146,7 @@ struct _xmlRMutex { |
| 16 | static pthread_key_t globalkey; |
| 17 | static pthread_t mainthread; |
| 18 | static pthread_once_t once_control = PTHREAD_ONCE_INIT; |
| 19 | +static pthread_once_t once_control_init = PTHREAD_ONCE_INIT; |
| 20 | static pthread_mutex_t global_init_lock = PTHREAD_MUTEX_INITIALIZER; |
| 21 | #elif defined HAVE_WIN32_THREADS |
| 22 | #if defined(HAVE_COMPILER_TLS) |
| 23 | @@ -915,7 +916,7 @@ xmlCleanupThreads(void) |
| 24 | #ifdef HAVE_PTHREAD_H |
| 25 | if ((libxml_is_threaded) && (pthread_key_delete != NULL)) |
| 26 | pthread_key_delete(globalkey); |
| 27 | - once_control = PTHREAD_ONCE_INIT; |
| 28 | + once_control = once_control_init; |
| 29 | #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) |
| 30 | if (globalkey != TLS_OUT_OF_INDEXES) { |
| 31 | xmlGlobalStateCleanupHelperParams *p; |
| 32 | -- |
| 33 | cgit v0.9.1 |