From: Benjamin Kosnik Date: Tue, 10 Oct 2006 10:14:13 +0000 (+0000) Subject: re PR libstdc++/29118 (Timeouts in libstdc++, libjava and libgomp testsuites) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8ba9f0133450c920cfd936ebdf26b19f016b10d5;p=gcc.git re PR libstdc++/29118 (Timeouts in libstdc++, libjava and libgomp testsuites) 2006-10-09 Benjamin Kosnik PR libstdc++/29118 * src/locale_init.cc (__get_locale_mutex): New. (locale::locale): Use it. (locale::global): Use it. From-SVN: r117600 --- diff --git a/libstdc++-v3/ChangeLog b/libstdc++-v3/ChangeLog index c88fb9984b1..6be5a03e5d2 100644 --- a/libstdc++-v3/ChangeLog +++ b/libstdc++-v3/ChangeLog @@ -1,3 +1,10 @@ +2006-10-09 Benjamin Kosnik + + PR libstdc++/29118 + * src/locale_init.cc (__get_locale_mutex): New. + (locale::locale): Use it. + (locale::global): Use it. + 2006-10-09 Benjamin Kosnik PR libstdc++/29095 diff --git a/libstdc++-v3/src/locale_init.cc b/libstdc++-v3/src/locale_init.cc index 2b6b4af2694..a2c18dd84cb 100644 --- a/libstdc++-v3/src/locale_init.cc +++ b/libstdc++-v3/src/locale_init.cc @@ -36,6 +36,13 @@ namespace { + __gnu_cxx::__mutex& + __get_locale_mutex() + { + static __gnu_cxx::__mutex locale_mutex; + return locale_mutex; + } + using namespace std; typedef char fake_locale_Impl[sizeof(locale::_Impl)] @@ -198,8 +205,6 @@ namespace __attribute__ ((aligned(__alignof__(std::__timepunct_cache)))); fake_time_cache_w timepunct_cache_w; #endif - - __gnu_cxx::__mutex locale_mutex; } // anonymous namespace _GLIBCXX_BEGIN_NAMESPACE(std) @@ -207,7 +212,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) locale::locale() throw() : _M_impl(0) { _S_initialize(); - __gnu_cxx::__scoped_lock sentry(locale_mutex); + __gnu_cxx::__scoped_lock sentry(__get_locale_mutex()); _S_global->_M_add_reference(); _M_impl = _S_global; } @@ -218,7 +223,7 @@ _GLIBCXX_BEGIN_NAMESPACE(std) _S_initialize(); _Impl* __old; { - __gnu_cxx::__scoped_lock sentry(locale_mutex); + __gnu_cxx::__scoped_lock sentry(__get_locale_mutex()); __old = _S_global; __other._M_impl->_M_add_reference(); _S_global = __other._M_impl;