Kaydet (Commit) e128f780 authored tarafından Mike Kaganski's avatar Mike Kaganski

replace double-checked locking patterns with thread safe local statics

Change-Id: I1bf67196e97411aeecc13ed4f91d1088a315e323
Reviewed-on: https://gerrit.libreoffice.org/62839
Tested-by: Jenkins
Reviewed-by: 's avatarMike Kaganski <mike.kaganski@collabora.com>
üst a2058e75
......@@ -225,17 +225,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
static RTTI * s_rtti = 0;
if (! s_rtti)
{
MutexGuard guard( Mutex::getGlobalMutex() );
if (! s_rtti)
{
static RTTI rtti_data;
s_rtti = &rtti_data;
}
}
rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
static RTTI rtti_data;
rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
if (! rtti)
terminate();
......
......@@ -317,17 +317,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, nullptr );
// avoiding locked counts
static RTTI * s_rtti = nullptr;
if (! s_rtti)
{
MutexGuard guard( Mutex::getGlobalMutex() );
if (! s_rtti)
{
static RTTI rtti_data;
s_rtti = &rtti_data;
}
}
rtti = s_rtti->getRTTI( reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr) );
static RTTI rtti_data;
rtti = rtti_data.getRTTI(reinterpret_cast<typelib_CompoundTypeDescription*>(pTypeDescr));
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti && "### no rtti for throwing exception!");
if (! rtti)
......
......@@ -223,17 +223,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
static RTTI * s_rtti = 0;
if (! s_rtti)
{
MutexGuard guard( Mutex::getGlobalMutex() );
if (! s_rtti)
{
static RTTI rtti_data;
s_rtti = &rtti_data;
}
}
rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
static RTTI rtti_data;
rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
if (! rtti)
terminate();
......
......@@ -262,17 +262,8 @@ namespace CPPU_CURRENT_NAMESPACE
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
static RTTI * s_rtti = 0;
if (! s_rtti)
{
MutexGuard guard( Mutex::getGlobalMutex() );
if (! s_rtti)
{
static RTTI rtti_data;
s_rtti = &rtti_data;
}
}
rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
static RTTI rtti_data;
rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti && "### no rtti for throwing exception!");
if (! rtti)
......
......@@ -236,17 +236,8 @@ namespace CPPU_CURRENT_NAMESPACE
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
static RTTI * s_rtti = 0;
if (! s_rtti)
{
MutexGuard guard( Mutex::getGlobalMutex() );
if (! s_rtti)
{
static RTTI rtti_data;
s_rtti = &rtti_data;
}
}
rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
static RTTI rtti_data;
rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
assert(rtti && "### no rtti for throwing exception!");
if (! rtti)
......
......@@ -222,17 +222,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, 0 );
// avoiding locked counts
static RTTI * s_rtti = 0;
if (! s_rtti)
{
MutexGuard guard( Mutex::getGlobalMutex() );
if (! s_rtti)
{
static RTTI rtti_data;
s_rtti = &rtti_data;
}
}
rtti = (type_info *)s_rtti->getRTTI( (typelib_CompoundTypeDescription *) pTypeDescr );
static RTTI rtti_data;
rtti = (type_info*)rtti_data.getRTTI((typelib_CompoundTypeDescription*)pTypeDescr);
TYPELIB_DANGER_RELEASE( pTypeDescr );
if (! rtti)
terminate();
......
......@@ -239,17 +239,8 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
// destruct uno exception
::uno_any_destruct( pUnoExc, nullptr );
// avoiding locked counts
static RTTI * s_rtti = nullptr;
if (! s_rtti)
{
MutexGuard guard( Mutex::getGlobalMutex() );
if (! s_rtti)
{
static RTTI rtti_data;
s_rtti = &rtti_data;
}
}
rtti = s_rtti->getRTTI(reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr));