You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stdcxx.apache.org by fa...@apache.org on 2008/04/04 11:51:00 UTC

svn commit: r644662 - /stdcxx/trunk/src/once.cpp

Author: faridz
Date: Fri Apr  4 02:50:57 2008
New Revision: 644662

URL: http://svn.apache.org/viewvc?rev=644662&view=rev
Log:
2008-04-04  Farid Zaripov  <fa...@epam.com>

	* src/once.cpp (__rw_once): Cast init to int& to avoid using mutex
	version of __rw_atomic_preincrement() when atomic version is present.

Modified:
    stdcxx/trunk/src/once.cpp

Modified: stdcxx/trunk/src/once.cpp
URL: http://svn.apache.org/viewvc/stdcxx/trunk/src/once.cpp?rev=644662&r1=644661&r2=644662&view=diff
==============================================================================
--- stdcxx/trunk/src/once.cpp (original)
+++ stdcxx/trunk/src/once.cpp Fri Apr  4 02:50:57 2008
@@ -120,7 +120,10 @@
 
 restart:
 
-    if (init == 0 && 1 == _RWSTD_ATOMIC_PREINCREMENT (init, false)) {
+    // cast init to int& (see STDCXX-792)
+    // casting should be removed after fixing STDCXX-794
+    if (init == 0 && 1 == _RWSTD_ATOMIC_PREINCREMENT (
+            _RWSTD_CONST_CAST (int&, init), false)) {
 
         // entered by the first thread and only the first time around,
         // unless the initialization function throws