Kaydet (Commit) 78628cd3 authored tarafından Jochen Nitschke's avatar Jochen Nitschke Kaydeden (comit) Noel Grandin

sal: use thread safe local static in getInternMutex

Change-Id: Iac7ca87e05228f3a2a187646496869a8b1bff602
Reviewed-on: https://gerrit.libreoffice.org/38436Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 8a400cfa
...@@ -33,7 +33,6 @@ ...@@ -33,7 +33,6 @@
#include <osl/interlck.h> #include <osl/interlck.h>
#include <rtl/alloc.h> #include <rtl/alloc.h>
#include <osl/mutex.h> #include <osl/mutex.h>
#include <osl/doublecheckedlocking.h>
#include <rtl/tencinfo.h> #include <rtl/tencinfo.h>
#include <string.h> #include <string.h>
...@@ -903,24 +902,7 @@ enum StrLifecycle { ...@@ -903,24 +902,7 @@ enum StrLifecycle {
static oslMutex static oslMutex
getInternMutex() getInternMutex()
{ {
static oslMutex pPoolGuard = nullptr; static oslMutex pPoolGuard = osl_createMutex();
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();
}
return pPoolGuard; return pPoolGuard;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment