Boost logo

Boost-Commit :

From: anthony_at_[hidden]
Date: 2007-10-08 03:18:28


Author: anthonyw
Date: 2007-10-08 03:18:27 EDT (Mon, 08 Oct 2007)
New Revision: 39777
URL: http://svn.boost.org/trac/boost/changeset/39777

Log:
Use InterlockedCompareExchange when _ReadWriteBarrier not available
Text files modified:
   trunk/boost/thread/win32/interlocked_read.hpp | 24 +++++++++++++++++++++++-
   1 files changed, 23 insertions(+), 1 deletions(-)

Modified: trunk/boost/thread/win32/interlocked_read.hpp
==============================================================================
--- trunk/boost/thread/win32/interlocked_read.hpp (original)
+++ trunk/boost/thread/win32/interlocked_read.hpp 2007-10-08 03:18:27 EDT (Mon, 08 Oct 2007)
@@ -9,7 +9,7 @@
 // accompanying file LICENSE_1_0.txt or copy at
 // http://www.boost.org/LICENSE_1_0.txt)
 
-#include <boost/detail/interlocked.hpp>
+#ifdef BOOST_MSVC
 
 extern "C" void _ReadWriteBarrier(void);
 #pragma intrinsic(_ReadWriteBarrier)
@@ -33,4 +33,26 @@
     }
 }
 
+#else
+
+#include <boost/detail/interlocked.hpp>
+
+namespace boost
+{
+ namespace detail
+ {
+ inline long interlocked_read_acquire(long volatile* x)
+ {
+ return BOOST_INTERLOCKED_COMPARE_EXCHANGE(x,0,0);
+ }
+ inline void* interlocked_read_acquire(void* volatile* x)
+ {
+ return BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(x,0,0);
+ }
+ }
+}
+
+#endif
+
+
 #endif


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk