diff options
author | Caolán McNamara <caolanm@redhat.com> | 2011-04-04 13:09:33 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2011-04-04 13:09:33 +0100 |
commit | 71b6f3d9a3bb80d0658cdcd578646daacc68cf95 (patch) | |
tree | 2b76cb7baae9d08a89e9e8e0ba1e940238be391f /cppuhelper/source/implbase.cxx | |
parent | 44d2445580c8f8c8555a1c94c445805f0305f3bd (diff) |
use rtl::Static where double-locked pattern used
Diffstat (limited to 'cppuhelper/source/implbase.cxx')
-rw-r--r-- | cppuhelper/source/implbase.cxx | 18 |
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 |