2 // detail/gcc_x86_fenced_block.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com)
7 // Distributed under the Boost Software License, Version 1.0. (See accompanying
8 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
11 #ifndef BOOST_ASIO_DETAIL_GCC_X86_FENCED_BLOCK_HPP
12 #define BOOST_ASIO_DETAIL_GCC_X86_FENCED_BLOCK_HPP
14 #if defined(_MSC_VER) && (_MSC_VER >= 1200)
16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200)
18 #include <boost/asio/detail/config.hpp>
20 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
22 #include <boost/asio/detail/push_options.hpp>
28 class gcc_x86_fenced_block
35 // Constructor for a half fenced block.
36 explicit gcc_x86_fenced_block(half_t)
40 // Constructor for a full fenced block.
41 explicit gcc_x86_fenced_block(full_t)
47 ~gcc_x86_fenced_block()
56 __asm__ __volatile__ (
64 static void barrier2()
67 __asm__ __volatile__ ("mfence" ::: "memory");
68 #else // defined(__SSE2__)
70 #endif // defined(__SSE2__)
78 #include <boost/asio/detail/pop_options.hpp>
80 #endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
82 #endif // BOOST_ASIO_DETAIL_GCC_X86_FENCED_BLOCK_HPP