1 // 2 // detail/fenced_block.hpp 3 // ~~~~~~~~~~~~~~~~~~~~~~~ 4 // 5 // Copyright (c) 2003-2021 Christopher M. Kohlhoff (chris at kohlhoff dot com) 6 // 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) 9 // 10 11 #ifndef BOOST_ASIO_DETAIL_FENCED_BLOCK_HPP 12 #define BOOST_ASIO_DETAIL_FENCED_BLOCK_HPP 13 14 #if defined(_MSC_VER) && (_MSC_VER >= 1200) 15 # pragma once 16 #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) 17 18 #include <boost/asio/detail/config.hpp> 19 20 #if !defined(BOOST_ASIO_HAS_THREADS) \ 21 || defined(BOOST_ASIO_DISABLE_FENCED_BLOCK) 22 # include <boost/asio/detail/null_fenced_block.hpp> 23 #elif defined(BOOST_ASIO_HAS_STD_ATOMIC) 24 # include <boost/asio/detail/std_fenced_block.hpp> 25 #elif defined(__MACH__) && defined(__APPLE__) 26 # include <boost/asio/detail/macos_fenced_block.hpp> 27 #elif defined(__sun) 28 # include <boost/asio/detail/solaris_fenced_block.hpp> 29 #elif defined(__GNUC__) && defined(__arm__) \ 30 && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) 31 # include <boost/asio/detail/gcc_arm_fenced_block.hpp> 32 #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) 33 # include <boost/asio/detail/gcc_hppa_fenced_block.hpp> 34 #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) 35 # include <boost/asio/detail/gcc_x86_fenced_block.hpp> 36 #elif defined(__GNUC__) \ 37 && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \ 38 && !defined(__INTEL_COMPILER) && !defined(__ICL) \ 39 && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) 40 # include <boost/asio/detail/gcc_sync_fenced_block.hpp> 41 #elif defined(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE) 42 # include <boost/asio/detail/win_fenced_block.hpp> 43 #else 44 # include <boost/asio/detail/null_fenced_block.hpp> 45 #endif 46 47 namespace boost { 48 namespace asio { 49 namespace detail { 50 51 #if !defined(BOOST_ASIO_HAS_THREADS) \ 52 || defined(BOOST_ASIO_DISABLE_FENCED_BLOCK) 53 typedef null_fenced_block fenced_block; 54 #elif defined(BOOST_ASIO_HAS_STD_ATOMIC) 55 typedef std_fenced_block fenced_block; 56 #elif defined(__MACH__) && defined(__APPLE__) 57 typedef macos_fenced_block fenced_block; 58 #elif defined(__sun) 59 typedef solaris_fenced_block fenced_block; 60 #elif defined(__GNUC__) && defined(__arm__) \ 61 && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) 62 typedef gcc_arm_fenced_block fenced_block; 63 #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) 64 typedef gcc_hppa_fenced_block fenced_block; 65 #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) 66 typedef gcc_x86_fenced_block fenced_block; 67 #elif defined(__GNUC__) \ 68 && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \ 69 && !defined(__INTEL_COMPILER) && !defined(__ICL) \ 70 && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) 71 typedef gcc_sync_fenced_block fenced_block; 72 #elif defined(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE) 73 typedef win_fenced_block fenced_block; 74 #else 75 typedef null_fenced_block fenced_block; 76 #endif 77 78 } // namespace detail 79 } // namespace asio 80 } // namespace boost 81 82 #endif // BOOST_ASIO_DETAIL_FENCED_BLOCK_HPP 83