[Libreoffice-commits] core.git: sal/rtl

Jochen Nitschke j.nitschke+logerrit at ok.de
Wed Jun 7 07:06:02 UTC 2017


 sal/rtl/ustring.cxx |   20 +-------------------
 1 file changed, 1 insertion(+), 19 deletions(-)

New commits:
commit 78628cd3847ca15790380a708db627b74dcac37e
Author: Jochen Nitschke <j.nitschke+logerrit at ok.de>
Date:   Tue Jun 6 12:12:15 2017 +0200

    sal: use thread safe local static in getInternMutex
    
    Change-Id: Iac7ca87e05228f3a2a187646496869a8b1bff602
    Reviewed-on: https://gerrit.libreoffice.org/38436
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/sal/rtl/ustring.cxx b/sal/rtl/ustring.cxx
index 7940d5af1240..ff466ff72724 100644
--- a/sal/rtl/ustring.cxx
+++ b/sal/rtl/ustring.cxx
@@ -33,7 +33,6 @@
 #include <osl/interlck.h>
 #include <rtl/alloc.h>
 #include <osl/mutex.h>
-#include <osl/doublecheckedlocking.h>
 #include <rtl/tencinfo.h>
 
 #include <string.h>
@@ -903,24 +902,7 @@ enum StrLifecycle {
 static oslMutex
 getInternMutex()
 {
-    static oslMutex pPoolGuard = nullptr;
-    if( !pPoolGuard )
-    {
-        oslMutex pGlobalGuard;
-        pGlobalGuard = *osl_getGlobalMutex();
-        osl_acquireMutex( pGlobalGuard );
-        if( !pPoolGuard )
-        {
-            oslMutex p = osl_createMutex();
-            OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-            pPoolGuard = p;
-        }
-        osl_releaseMutex( pGlobalGuard );
-    }
-    else
-    {
-        OSL_DOUBLE_CHECKED_LOCKING_MEMORY_BARRIER();
-    }
+    static oslMutex pPoolGuard = osl_createMutex();
 
     return pPoolGuard;
 }


More information about the Libreoffice-commits mailing list