summaryrefslogtreecommitdiff
path: root/cppuhelper/source/implbase.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2011-04-04 13:09:33 +0100
committerCaolán McNamara <caolanm@redhat.com>2011-04-04 13:09:33 +0100
commit71b6f3d9a3bb80d0658cdcd578646daacc68cf95 (patch)
tree2b76cb7baae9d08a89e9e8e0ba1e940238be391f /cppuhelper/source/implbase.cxx
parent44d2445580c8f8c8555a1c94c445805f0305f3bd (diff)
use rtl::Static where double-locked pattern used
Diffstat (limited to 'cppuhelper/source/implbase.cxx')
-rw-r--r--cppuhelper/source/implbase.cxx18
1 files changed, 7 insertions, 11 deletions
diff --git a/cppuhelper/source/implbase.cxx b/cppuhelper/source/implbase.cxx
index 162f11d81cc8..a8a3fee844f9 100644
--- a/cppuhelper/source/implbase.cxx
+++ b/cppuhelper/source/implbase.cxx
@@ -31,6 +31,7 @@
#include <cppuhelper/implbase.hxx>
#include <cppuhelper/compbase.hxx>
#include <osl/diagnose.h>
+#include <rtl/instance.hxx>
#include <rtl/uuid.h>
#include <com/sun/star/lang/XComponent.hpp>
@@ -41,22 +42,17 @@ using namespace ::rtl;
using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
+namespace
+{
+ class theImplHelperInitMutex : public rtl::Static<Mutex, theImplHelperInitMutex>{};
+}
+
namespace cppu
{
//==================================================================================================
Mutex & SAL_CALL getImplHelperInitMutex(void) SAL_THROW( () )
{
- 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;
+ return theImplHelperInitMutex::get();
}
// ClassDataBase