summaryrefslogtreecommitdiff
path: root/unotools/source/config/useroptions.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'unotools/source/config/useroptions.cxx')
-rw-r--r--unotools/source/config/useroptions.cxx25
1 files changed, 6 insertions, 19 deletions
diff --git a/unotools/source/config/useroptions.cxx b/unotools/source/config/useroptions.cxx
index ee88691535a2..11a781213b4c 100644
--- a/unotools/source/config/useroptions.cxx
+++ b/unotools/source/config/useroptions.cxx
@@ -985,27 +985,14 @@ SvtUserOptions::~SvtUserOptions()
// -----------------------------------------------------------------------
+namespace
+{
+ class theUserOptionsMutex : public rtl::Static<osl::Mutex, theUserOptionsMutex>{};
+}
+
::osl::Mutex& SvtUserOptions::GetInitMutex()
{
- // 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 another instance of our class will be faster then this instance!
- 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 theUserOptionsMutex::get();
}
// -----------------------------------------------------------------------