Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r74822 - trunk/boost/asio/detail
From: chris_at_[hidden]
Date: 2011-10-08 17:31:26


Author: chris_kohlhoff
Date: 2011-10-08 17:31:26 EDT (Sat, 08 Oct 2011)
New Revision: 74822
URL: http://svn.boost.org/trac/boost/changeset/74822

Log:
Fix crash due to gcc_x86_fenced_block that shows up when using the Intel C++ compiler. Refs #5763
Text files modified:
   trunk/boost/asio/detail/gcc_x86_fenced_block.hpp | 23 ++++++++++++++++++-----
   1 files changed, 18 insertions(+), 5 deletions(-)

Modified: trunk/boost/asio/detail/gcc_x86_fenced_block.hpp
==============================================================================
--- trunk/boost/asio/detail/gcc_x86_fenced_block.hpp (original)
+++ trunk/boost/asio/detail/gcc_x86_fenced_block.hpp 2011-10-08 17:31:26 EDT (Sat, 08 Oct 2011)
@@ -32,22 +32,35 @@
   // Constructor.
   gcc_x86_fenced_block()
   {
- barrier();
+ barrier1();
   }
 
   // Destructor.
   ~gcc_x86_fenced_block()
   {
- barrier();
+ barrier2();
   }
 
 private:
- static int barrier()
+ static int barrier1()
   {
- int r = 0;
- __asm__ __volatile__ ("xchgl %%eax, %0" : "=m" (r) : : "memory", "cc");
+ int r = 0, m = 1;
+ __asm__ __volatile__ (
+ "xchgl %0, %1" :
+ "=r"(r), "=m"(m) :
+ "0"(1), "m"(m) :
+ "memory", "cc");
     return r;
   }
+
+ static void barrier2()
+ {
+#if defined(__SSE2__)
+ __asm__ __volatile__ ("mfence" ::: "memory");
+#else // defined(__SSE2__)
+ barrier1();
+#endif // defined(__SSE2__)
+ }
 };
 
 } // namespace detail


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