diff options
Diffstat (limited to 'unotools/source/config/startoptions.cxx')
-rw-r--r-- | unotools/source/config/startoptions.cxx | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/unotools/source/config/startoptions.cxx b/unotools/source/config/startoptions.cxx index 98d17b9a739b..c47b34946dd3 100644 --- a/unotools/source/config/startoptions.cxx +++ b/unotools/source/config/startoptions.cxx @@ -427,29 +427,17 @@ void SvtStartOptions::SetConnectionURL( const OUString& sURL ) m_pDataContainer->SetConnectionURL( sURL ); } +namespace +{ + class theStartOptionsMutex : public rtl::Static<osl::Mutex, theStartOptionsMutex>{}; +} + //***************************************************************************************************************** // private method //***************************************************************************************************************** Mutex& SvtStartOptions::GetOwnStaticMutex() { - // Initialize static mutex only for one time! - static Mutex* pMutex = NULL; - // If these method first called (Mutex not already exist!) ... - if( pMutex == NULL ) - { - // ... we must create a new one. Protect follow code with the global mutex - - // It must be - we create a static variable! - MutexGuard aGuard( Mutex::getGlobalMutex() ); - // We must check our pointer again - because it can be that another instance of ouer class will be fastr then these! - if( pMutex == NULL ) - { - // Create the new mutex and set it for return on static variable. - static Mutex aMutex; - pMutex = &aMutex; - } - } - // Return new created or already existing mutex object. - return *pMutex; + return theStartOptionsMutex::get(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |