summaryrefslogtreecommitdiffstats
path: root/contrib/libstdc++/src/locale_init.cc
diff options
context:
space:
mode:
Diffstat (limited to 'contrib/libstdc++/src/locale_init.cc')
-rw-r--r--contrib/libstdc++/src/locale_init.cc24
1 files changed, 12 insertions, 12 deletions
diff --git a/contrib/libstdc++/src/locale_init.cc b/contrib/libstdc++/src/locale_init.cc
index 7252bc5..b2c8ea2 100644
--- a/contrib/libstdc++/src/locale_init.cc
+++ b/contrib/libstdc++/src/locale_init.cc
@@ -89,9 +89,8 @@ namespace __gnu_internal
extern std::__timepunct_cache<wchar_t> timepunct_cache_w;
#endif
- // Mutex objects for locale initialization.
- __glibcxx_mutex_define_initialized(locale_cons_mutex);
- __glibcxx_mutex_define_initialized(locale_global_mutex);
+ // Mutex object for locale initialization.
+ __glibcxx_mutex_define_initialized(locale_mutex);
} // namespace __gnu_internal
namespace std
@@ -101,23 +100,24 @@ namespace std
locale::locale() throw() : _M_impl(0)
{
_S_initialize();
- __glibcxx_mutex_lock(__gnu_internal::locale_cons_mutex);
+ __gnu_cxx::lock sentry(__gnu_internal::locale_mutex);
_S_global->_M_add_reference();
_M_impl = _S_global;
- __glibcxx_mutex_unlock(__gnu_internal::locale_cons_mutex);
}
locale
locale::global(const locale& __other)
{
_S_initialize();
- __glibcxx_mutex_lock(__gnu_internal::locale_global_mutex);
- _Impl* __old = _S_global;
- __other._M_impl->_M_add_reference();
- _S_global = __other._M_impl;
- if (__other.name() != "*")
- setlocale(LC_ALL, __other.name().c_str());
- __glibcxx_mutex_unlock(__gnu_internal::locale_global_mutex);
+ _Impl* __old;
+ {
+ __gnu_cxx::lock sentry(__gnu_internal::locale_mutex);
+ __old = _S_global;
+ __other._M_impl->_M_add_reference();
+ _S_global = __other._M_impl;
+ if (__other.name() != "*")
+ setlocale(LC_ALL, __other.name().c_str());
+ }
// Reference count sanity check: one reference removed for the
// subsition of __other locale, one added by return-by-value. Net
OpenPOWER on IntegriCloud