avoid use of global mutex

This commit is contained in:
Daniel Boelzle
2000-10-06 14:15:09 +00:00
parent 52308925ab
commit b11926a7a0
2 changed files with 22 additions and 5 deletions

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: implbase.hxx,v $ * $RCSfile: implbase.hxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: hr $ $Date: 2000-09-18 15:26:09 $ * last change: $Author: dbo $ $Date: 2000-10-06 15:15:09 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -109,6 +109,8 @@ struct ClassData : public ClassDataBase
::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId(); ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId();
}; };
//==================================================================================================
::osl::Mutex & SAL_CALL getImplHelperInitMutex(void);
} }
// //
@@ -136,7 +138,7 @@ protected: \
ClassData & rCD = * static_cast< ClassData * >( &s_aCD ); \ ClassData & rCD = * static_cast< ClassData * >( &s_aCD ); \
if (! rCD.bOffsetsInit) \ if (! rCD.bOffsetsInit) \
{ \ { \
::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); \ ::osl::MutexGuard aGuard( getImplHelperInitMutex() ); \
if (! rCD.bOffsetsInit) \ if (! rCD.bOffsetsInit) \
{ \ { \
char * pBase = (char *)this; char * pBase = (char *)this;

View File

@@ -2,9 +2,9 @@
* *
* $RCSfile: implbase.cxx,v $ * $RCSfile: implbase.cxx,v $
* *
* $Revision: 1.1.1.1 $ * $Revision: 1.2 $
* *
* last change: $Author: hr $ $Date: 2000-09-18 15:26:10 $ * last change: $Author: dbo $ $Date: 2000-10-06 15:15:09 $
* *
* The Contents of this file are made available subject to the terms of * The Contents of this file are made available subject to the terms of
* either of the following licenses * either of the following licenses
@@ -79,6 +79,21 @@ using namespace com::sun::star::lang;
namespace cppu namespace cppu
{ {
//==================================================================================================
Mutex & SAL_CALL getImplHelperInitMutex(void)
{
static Mutex * s_pMutex = 0;
if (! s_pMutex)
{
MutexGuard aGuard( Mutex::getGlobalMutex() );
if (! s_pMutex)
{
static Mutex s_aMutex;
s_pMutex = & s_aMutex;
}
}
return * s_pMutex;
}
// ClassDataBase // ClassDataBase
//__________________________________________________________________________________________________ //__________________________________________________________________________________________________