diff options
author | kan <kan@FreeBSD.org> | 2005-06-03 03:29:38 +0000 |
---|---|---|
committer | kan <kan@FreeBSD.org> | 2005-06-03 03:29:38 +0000 |
commit | 3b6c93380e20c56b8151f9c6fc3916670b987df5 (patch) | |
tree | c4e455c4fe8d2a3ed1d621536386e3e252ad36bc /contrib/libstdc++/src/locale_init.cc | |
parent | 2156e40a831a8e0ab68e4bc091c2940bf46ca6df (diff) | |
download | FreeBSD-src-3b6c93380e20c56b8151f9c6fc3916670b987df5.zip FreeBSD-src-3b6c93380e20c56b8151f9c6fc3916670b987df5.tar.gz |
Gcc 3.4.4 C++ support bits.
Diffstat (limited to 'contrib/libstdc++/src/locale_init.cc')
-rw-r--r-- | contrib/libstdc++/src/locale_init.cc | 24 |
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 |