re PR libstdc++/29118 (Timeouts in libstdc++, libjava and libgomp testsuites)
authorBenjamin Kosnik <bkoz@redhat.com>
Tue, 10 Oct 2006 10:14:13 +0000 (10:14 +0000)
committerBenjamin Kosnik <bkoz@gcc.gnu.org>
Tue, 10 Oct 2006 10:14:13 +0000 (10:14 +0000)
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

libstdc++-v3/ChangeLog
libstdc++-v3/src/locale_init.cc

index c88fb9984b1b8ff4afc5a853b652eb788e7d02d7..6be5a03e5d21699b918aa1ce29a6e6b62da61567 100644 (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
index 2b6b4af269406f1e281459ed1ca3b509488ba2d1..a2c18dd84cb0212c3156463e359ebc908459cd50 100644 (file)
 
 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;