stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r580959 - /incubator/stdcxx/branches/4.2.0/src/punct.cpp
Date Mon, 01 Oct 2007 13:56:50 GMT
Author: faridz
Date: Mon Oct  1 06:56:49 2007
New Revision: 580959

URL: http://svn.apache.org/viewvc?rev=580959&view=rev
Log:
2007-10-01  Farid Zaripov  <farid_zaripov@epam.com>

	STDCXX-453
	* punct.cpp (__rw_get_moneypunct): After creating __rw_setlocale
	object check if the locale data is initialized by another thread
	to avoid doing unnecessary work and leaking memory.
	(__rw_get_numpunct): Ditto.

Modified:
    incubator/stdcxx/branches/4.2.0/src/punct.cpp

Modified: incubator/stdcxx/branches/4.2.0/src/punct.cpp
URL: http://svn.apache.org/viewvc/incubator/stdcxx/branches/4.2.0/src/punct.cpp?rev=580959&r1=580958&r2=580959&view=diff
==============================================================================
--- incubator/stdcxx/branches/4.2.0/src/punct.cpp (original)
+++ incubator/stdcxx/branches/4.2.0/src/punct.cpp Mon Oct  1 06:56:49 2007
@@ -132,6 +132,14 @@
     // set all categories -- need LC_NUMERIC and LC_CTYPE
     const __rw_setlocale clocale (locname, _RWSTD_LC_ALL);
 
+    if (pfacet->_C_data ()) {
+        // check to see if another thread may have set _C_data()
+        // while we were waiting for the lock in __rw_setlocale
+        // ctor above and, if so, call self recursively on the
+        // already initialized `impdata'
+        return __rw_get_numpunct (pfacet, flags);
+    }
+
     // get the lconv data
     const lconv* const pconv = localeconv ();
     if (!pconv)
@@ -307,6 +315,14 @@
     
     // set all categories -- need LC_NUMERIC and LC_CTYPE
     const __rw_setlocale clocale (locname, _RWSTD_LC_ALL);
+
+    if (pfacet->_C_data ()) {
+        // check to see if another thread may have set _C_data()
+        // while we were waiting for the lock in __rw_setlocale
+        // ctor above and, if so, call self recursively on the
+        // already initialized `impdata'
+        return __rw_get_moneypunct (pfacet, flags);
+    }
 
     // get the lconv data
     const lconv* const pconv = localeconv ();



Mime
View raw message