From 71b6f3d9a3bb80d0658cdcd578646daacc68cf95 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Mon, 4 Apr 2011 13:09:33 +0100 Subject: use rtl::Static where double-locked pattern used --- cppuhelper/source/implbase.cxx | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) (limited to 'cppuhelper/source/implbase.cxx') 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 #include #include +#include #include #include @@ -41,22 +42,17 @@ using namespace ::rtl; using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +namespace +{ + class theImplHelperInitMutex : public rtl::Static{}; +} + 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 -- cgit