2 // detail/win_fenced_block.hpp
3 // ~~~~~~~~~~~~~~~~~~~~~~~~~~~
5 // Copyright (c) 2003-2016 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_WIN_FENCED_BLOCK_HPP
12 #define BOOST_ASIO_DETAIL_WIN_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(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE)
22 #include <boost/asio/detail/socket_types.hpp>
24 #include <boost/asio/detail/push_options.hpp>
30 class win_fenced_block
37 // Constructor for a half fenced block.
38 explicit win_fenced_block(half_t)
42 // Constructor for a full fenced block.
43 explicit win_fenced_block(full_t)
45 #if defined(__BORLANDC__)
47 ::InterlockedExchange(&barrier, 1);
48 #elif defined(BOOST_ASIO_MSVC) \
49 && ((BOOST_ASIO_MSVC < 1400) || !defined(MemoryBarrier))
51 # pragma warning(push)
52 # pragma warning(disable:4793)
54 __asm { xchg barrier, eax }
56 # endif // defined(_M_IX86)
65 #if defined(__BORLANDC__)
67 ::InterlockedExchange(&barrier, 1);
68 #elif defined(BOOST_ASIO_MSVC) \
69 && ((BOOST_ASIO_MSVC < 1400) || !defined(MemoryBarrier))
71 # pragma warning(push)
72 # pragma warning(disable:4793)
74 __asm { xchg barrier, eax }
76 # endif // defined(_M_IX86)
87 #include <boost/asio/detail/pop_options.hpp>
89 #endif // defined(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE)
91 #endif // BOOST_ASIO_DETAIL_WIN_FENCED_BLOCK_HPP