stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From elemi...@apache.org
Subject svn commit: r644466 - in /stdcxx/trunk/src: locale_global.cpp setlocale.cpp
Date Thu, 03 Apr 2008 20:17:55 GMT
Author: elemings
Date: Thu Apr  3 13:17:54 2008
New Revision: 644466

URL: http://svn.apache.org/viewvc?rev=644466&view=rev
Log:
2008-04-03  Eric Lemings  <eric.lemings@roguewave.com>

	STDCXX-811
	* src/setlocale.cpp (__rw_setlocale_mutex): Make mutex visible
	to other translation units.
	* src/locale_global.cpp (std::locale::global): __rw_setlocale
	object won't work because destructor restores previous locale.
	Guard on mutex and revert to original call to setlocale().


Modified:
    stdcxx/trunk/src/locale_global.cpp
    stdcxx/trunk/src/setlocale.cpp

Modified: stdcxx/trunk/src/locale_global.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/locale_global.cpp?rev=644466&r1=644465&r2=644466&view=diff
==============================================================================
--- stdcxx/trunk/src/locale_global.cpp (original)
+++ stdcxx/trunk/src/locale_global.cpp Thu Apr  3 13:17:54 2008
@@ -29,6 +29,7 @@
 #define _RWSTD_LIB_SRC
 
 #include <rw/_defs.h>
+#include <rw/_mutex.h>
 
 #include <locale.h>
 #include <string.h>
@@ -37,9 +38,13 @@
 #include <loc/_locale.h>
 
 #include "locale_body.h"
-#include "setlocale.h"
 
 
+_RWSTD_NAMESPACE (__rw) {
+
+extern __rw_mutex __rw_setlocale_mutex;
+
+}   // namespace __rw
 
 _RWSTD_NAMESPACE (std) { 
 
@@ -52,10 +57,11 @@
 
         // if the global locale has a name, call setlocale()
 
+        _RWSTD_MT_GUARD (_RW::__rw_setlocale_mutex);
+
         // assumes all locale names (i.e., including those of combined
         // locales) are in a format understandable by setlocale()
-        const _RW::__rw_setlocale clocale (rhs.name().c_str(), _RWSTD_LC_ALL);
-        _RWSTD_UNUSED(clocale);
+        setlocale (_RWSTD_LC_ALL, rhs.name ().c_str ());
 
         // FIXME:
         // handle unnamed locales (i.e., locales containing non-standard

Modified: stdcxx/trunk/src/setlocale.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/setlocale.cpp?rev=644466&r1=644465&r2=644466&view=diff
==============================================================================
--- stdcxx/trunk/src/setlocale.cpp (original)
+++ stdcxx/trunk/src/setlocale.cpp Thu Apr  3 13:17:54 2008
@@ -72,8 +72,8 @@
 
 _RWSTD_NAMESPACE (__rw) { 
 
-// "setlocale" synchronization
-static __rw_mutex __rw_setlocale_mutex;
+// "setlocale" synchronization (internal, not exported)
+__rw_mutex __rw_setlocale_mutex;
 
 // ctor changes the C library locale, saving the old locale to be 
 // restored by the dtor



Mime
View raw message