diff options
author | Jochen Nitschke <j.nitschke+logerrit@ok.de> | 2017-06-06 12:12:15 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-06-07 09:05:41 +0200 |
commit | 78628cd3847ca15790380a708db627b74dcac37e (patch) | |
tree | 19597b0b3936dac31da9e2271d6452f4499137c6 /sal | |
parent | 8a400cfa468655142103f18f722adf1d5cbda9c7 (diff) |
sal: use thread safe local static in getInternMutex
Change-Id: Iac7ca87e05228f3a2a187646496869a8b1bff602
Reviewed-on: https://gerrit.libreoffice.org/38436
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sal')
-rw-r--r-- | sal/rtl/ustring.cxx | 20 |
1 files changed, 1 insertions, 19 deletions
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; } |