diff --git a/include/unotools/syslocale.hxx b/include/unotools/syslocale.hxx
index ae3153b7976a..e5bc9dd85224 100644
--- a/include/unotools/syslocale.hxx
+++ b/include/unotools/syslocale.hxx
@@ -31,8 +31,6 @@ class LocaleDataWrapper;
class SvtSysLocale_Impl;
class SvtSysLocaleOptions;
-namespace osl { class Mutex; }
-
/**
SvtSysLocale provides a refcounted single instance of an application wide
LocaleDataWrapper and CharClass which always
@@ -48,8 +46,6 @@ class UNOTOOLS_DLLPUBLIC SvtSysLocale
std::shared_ptr pImpl;
- UNOTOOLS_DLLPRIVATE static ::osl::Mutex& GetMutex();
-
public:
SvtSysLocale();
~SvtSysLocale();
diff --git a/unotools/source/misc/syslocale.cxx b/unotools/source/misc/syslocale.cxx
index 889d9b34688f..954e7e94caf8 100644
--- a/unotools/source/misc/syslocale.cxx
+++ b/unotools/source/misc/syslocale.cxx
@@ -31,6 +31,7 @@
#include
#include
+#include
#include
#include
@@ -41,6 +42,18 @@ namespace {
std::weak_ptr g_pSysLocale;
+// static
+std::mutex& GetMutex()
+{
+ // #i77768# Due to a static reference in the toolkit lib
+ // we need a mutex that lives longer than the svl library.
+ // Otherwise the dtor would use a destructed mutex!!
+ static std::mutex* persistentMutex(new std::mutex);
+
+ return *persistentMutex;
+}
+
+
}
class SvtSysLocale_Impl : public utl::ConfigurationListener
@@ -88,7 +101,7 @@ void SvtSysLocale_Impl::ConfigurationChanged( utl::ConfigurationBroadcaster*, Co
!(nHint & ConfigurationHints::DatePatterns) )
return;
- MutexGuard aGuard( SvtSysLocale::GetMutex() );
+ std::unique_lock aGuard( GetMutex() );
const LanguageTag& rLanguageTag = aSysLocaleOptions.GetRealLanguageTag();
if ( nHint & ConfigurationHints::Locale )
@@ -115,7 +128,7 @@ std::vector SvtSysLocale_Impl::getDateAcceptancePatternsConfig() const
SvtSysLocale::SvtSysLocale()
{
- MutexGuard aGuard( GetMutex() );
+ std::unique_lock aGuard( GetMutex() );
pImpl = g_pSysLocale.lock();
if ( !pImpl )
{
@@ -126,21 +139,10 @@ SvtSysLocale::SvtSysLocale()
SvtSysLocale::~SvtSysLocale()
{
- MutexGuard aGuard( GetMutex() );
+ std::unique_lock aGuard( GetMutex() );
pImpl.reset();
}
-// static
-Mutex& SvtSysLocale::GetMutex()
-{
- // #i77768# Due to a static reference in the toolkit lib
- // we need a mutex that lives longer than the svl library.
- // Otherwise the dtor would use a destructed mutex!!
- static Mutex* persistentMutex(new Mutex);
-
- return *persistentMutex;
-}
-
const LocaleDataWrapper& SvtSysLocale::GetLocaleData() const
{
return *(pImpl->pLocaleData);