stdcxx-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From far...@apache.org
Subject svn commit: r648132 - /stdcxx/trunk/include/rw/_mutex.h
Date Tue, 15 Apr 2008 07:05:22 GMT
Author: faridz
Date: Tue Apr 15 00:05:20 2008
New Revision: 648132

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

	* include/rw/_mutex.h (__rw_atomic_exchange): New overload for bool type to
	avoid using of template overload with mutex to atomically swap two bool's
	(used in std::ios_base::sync_with_stdio()).

Modified:
    stdcxx/trunk/include/rw/_mutex.h

Modified: stdcxx/trunk/include/rw/_mutex.h
URL: http://svn.apache.org/viewvc/stdcxx/trunk/include/rw/_mutex.h?rev=648132&r1=648131&r2=648132&view=diff
==============================================================================
--- stdcxx/trunk/include/rw/_mutex.h (original)
+++ stdcxx/trunk/include/rw/_mutex.h Tue Apr 15 00:05:20 2008
@@ -1902,6 +1902,36 @@
 #  define _RWSTD_NO_ATOMIC_OPS
 #endif   // _RWSTD_NO_ATOMIC_OPS
 
+
+/********************** generic bool functions ************************/
+
+#ifndef _RWSTD_NO_BOOL
+
+#  if _RWSTD_BOOL_SIZE == _RWSTD_CHAR_SIZE
+#    define _RWSTD_BOOL_TYPE char
+#  elif _RWSTD_BOOL_SIZE == _RWSTD_SHORT_SIZE
+#    define _RWSTD_BOOL_TYPE short
+#  elif _RWSTD_BOOL_SIZE == _RWSTD_INT_SIZE
+#    define _RWSTD_BOOL_TYPE int
+#  endif
+
+#  ifdef _RWSTD_BOOL_TYPE
+
+inline bool
+__rw_atomic_exchange (bool &__x, bool __y, bool)
+{
+    return 0 != __rw_atomic_exchange (
+                    _RWSTD_REINTERPRET_CAST (_RWSTD_BOOL_TYPE&, __x),
+                    _RWSTD_STATIC_CAST (_RWSTD_BOOL_TYPE, __y),
+                    false);
+}
+
+#    undef _RWSTD_BOOL_TYPE
+#  endif   // _RWSTD_BOOL_TYPE
+
+#endif   // _RWSTD_NO_BOOL
+
+
 /********************** generic long functions ************************/
 
 #if _RWSTD_LONG_SIZE == _RWSTD_INT_SIZE



Mime
View raw message