re PR libstdc++/29118 (Timeouts in libstdc++, libjava and libgomp testsuites)

2006-10-09  Benjamin Kosnik  <bkoz@redhat.com>

	PR libstdc++/29118
	* src/locale_init.cc (__get_locale_mutex): New. 
	(locale::locale): Use it.
	(locale::global): Use it.

From-SVN: r117600
This commit is contained in:
Benjamin Kosnik 2006-10-10 10:14:13 +00:00 committed by Benjamin Kosnik
parent 599a964a52
commit 8ba9f01334
2 changed files with 16 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2006-10-09 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/29118
* src/locale_init.cc (__get_locale_mutex): New.
(locale::locale): Use it.
(locale::global): Use it.
2006-10-09 Benjamin Kosnik <bkoz@redhat.com>
PR libstdc++/29095

View File

@ -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<wchar_t>))));
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;