fenced_block.hpp 3.0 KB

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