summaryrefslogtreecommitdiff
path: root/unotools/source/config/viewoptions.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'unotools/source/config/viewoptions.cxx')
-rw-r--r--unotools/source/config/viewoptions.cxx24
1 files changed, 6 insertions, 18 deletions
diff --git a/unotools/source/config/viewoptions.cxx b/unotools/source/config/viewoptions.cxx
index c0eecd9e7edd..9fe4aba17ed7 100644
--- a/unotools/source/config/viewoptions.cxx
+++ b/unotools/source/config/viewoptions.cxx
@@ -1225,29 +1225,17 @@ void SvtViewOptions::SetUserItem( const ::rtl::OUString& sName ,
}
}
+namespace
+{
+ class theViewOptionsMutex : public rtl::Static<osl::Mutex, theViewOptionsMutex>{};
+}
+
//*****************************************************************************************************************
// private method
//*****************************************************************************************************************
::osl::Mutex& SvtViewOptions::GetOwnStaticMutex()
{
- // Initialize static mutex only for one time!
- static ::osl::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!
- ::osl::MutexGuard aGuard( ::osl::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 ::osl::Mutex aMutex;
- pMutex = &aMutex;
- }
- }
- // Return new created or already existing mutex object.
- return *pMutex;
+ return theViewOptionsMutex::get();
}
void SvtViewOptions::AcquireOptions()