Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r79520 - trunk/boost/asio/detail
From: chris_at_[hidden]
Date: 2012-07-15 00:18:38


Author: chris_kohlhoff
Date: 2012-07-15 00:18:37 EDT (Sun, 15 Jul 2012)
New Revision: 79520
URL: http://svn.boost.org/trac/boost/changeset/79520

Log:
Use SSE2 load and store fences.
Text files modified:
   trunk/boost/asio/detail/gcc_x86_fenced_block.hpp | 21 +++++++++++++++------
   1 files changed, 15 insertions(+), 6 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 2012-07-15 00:18:37 EDT (Sun, 15 Jul 2012)
@@ -40,17 +40,17 @@
   // Constructor for a full fenced block.
   explicit gcc_x86_fenced_block(full_t)
   {
- barrier1();
+ lbarrier();
   }
 
   // Destructor.
   ~gcc_x86_fenced_block()
   {
- barrier2();
+ sbarrier();
   }
 
 private:
- static int barrier1()
+ static int barrier()
   {
     int r = 0, m = 1;
     __asm__ __volatile__ (
@@ -61,12 +61,21 @@
     return r;
   }
 
- static void barrier2()
+ static void lbarrier()
   {
 #if defined(__SSE2__)
- __asm__ __volatile__ ("mfence" ::: "memory");
+ __asm__ __volatile__ ("lfence" ::: "memory");
 #else // defined(__SSE2__)
- barrier1();
+ barrier();
+#endif // defined(__SSE2__)
+ }
+
+ static void sbarrier()
+ {
+#if defined(__SSE2__)
+ __asm__ __volatile__ ("sfence" ::: "memory");
+#else // defined(__SSE2__)
+ barrier();
 #endif // defined(__SSE2__)
   }
 };


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