components/libxml2/patches/PTHREAD_ONCE_INIT.patch
author Mike Sullivan <Mike.Sullivan@Oracle.COM>
Mon, 11 Mar 2013 10:38:09 -0700
branchs11-update
changeset 2520 ceec631e74d1
parent 2452 9dc4dfa4b04d
permissions -rw-r--r--
Close of build 10.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2452
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     1
From 3f6cfbd1d38d0634a2ddcb9a0a13e1b5a2195a5e Mon Sep 17 00:00:00 2001
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     2
From: Friedrich Haubensak <[email protected]>
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     3
Date: Wed, 12 Sep 2012 15:34:53 +0000
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     4
Subject: Fix a thread portability problem
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     5
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     6
cannot compile libxml2-2.9.0 using studio 12.1 compiler on solaris 10
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     7
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     8
I.M.O. structure initializer (as PTHREAD_ONCE_INIT) cannot be used in
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
     9
a structure assignment anyway
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    10
---
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    11
diff --git a/threads.c b/threads.c
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    12
index f206149..7e85a26 100644
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    13
--- a/threads.c
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    14
+++ b/threads.c
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    15
@@ -146,6 +146,7 @@ struct _xmlRMutex {
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    16
 static pthread_key_t globalkey;
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    17
 static pthread_t mainthread;
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    18
 static pthread_once_t once_control = PTHREAD_ONCE_INIT;
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    19
+static pthread_once_t once_control_init = PTHREAD_ONCE_INIT;
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    20
 static pthread_mutex_t global_init_lock = PTHREAD_MUTEX_INITIALIZER;
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    21
 #elif defined HAVE_WIN32_THREADS
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    22
 #if defined(HAVE_COMPILER_TLS)
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    23
@@ -915,7 +916,7 @@ xmlCleanupThreads(void)
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    24
 #ifdef HAVE_PTHREAD_H
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    25
     if ((libxml_is_threaded)  && (pthread_key_delete != NULL))
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    26
         pthread_key_delete(globalkey);
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    27
-    once_control = PTHREAD_ONCE_INIT;
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    28
+    once_control = once_control_init;
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    29
 #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    30
     if (globalkey != TLS_OUT_OF_INDEXES) {
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    31
         xmlGlobalStateCleanupHelperParams *p;
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    32
--
9dc4dfa4b04d 15825143 SUNBT7206540 Upgrade libxml2 to version 2.9.0
Petr Sumbera <petr.sumbera@oracle.com>
parents:
diff changeset
    33
cgit v0.9.0.2