fenced_block.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778
  1. //
  2. // detail/fenced_block.hpp
  3. // ~~~~~~~~~~~~~~~~~~~~~~~
  4. //
  5. // Copyright (c) 2003-2015 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(__MACH__) && defined(__APPLE__)
  20. # include <boost/asio/detail/macos_fenced_block.hpp>
  21. #elif defined(__sun)
  22. # include <boost/asio/detail/solaris_fenced_block.hpp>
  23. #elif defined(__GNUC__) && defined(__arm__) \
  24. && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
  25. # include <boost/asio/detail/gcc_arm_fenced_block.hpp>
  26. #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__))
  27. # include <boost/asio/detail/gcc_hppa_fenced_block.hpp>
  28. #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
  29. # include <boost/asio/detail/gcc_x86_fenced_block.hpp>
  30. #elif defined(__GNUC__) \
  31. && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \
  32. && !defined(__INTEL_COMPILER) && !defined(__ICL) \
  33. && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__)
  34. # include <boost/asio/detail/gcc_sync_fenced_block.hpp>
  35. #elif defined(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE)
  36. # include <boost/asio/detail/win_fenced_block.hpp>
  37. #else
  38. # include <boost/asio/detail/null_fenced_block.hpp>
  39. #endif
  40. namespace boost {
  41. namespace asio {
  42. namespace detail {
  43. #if !defined(BOOST_ASIO_HAS_THREADS) \
  44. || defined(BOOST_ASIO_DISABLE_FENCED_BLOCK)
  45. typedef null_fenced_block fenced_block;
  46. #elif defined(__MACH__) && defined(__APPLE__)
  47. typedef macos_fenced_block fenced_block;
  48. #elif defined(__sun)
  49. typedef solaris_fenced_block fenced_block;
  50. #elif defined(__GNUC__) && defined(__arm__) \
  51. && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4)
  52. typedef gcc_arm_fenced_block fenced_block;
  53. #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__))
  54. typedef gcc_hppa_fenced_block fenced_block;
  55. #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
  56. typedef gcc_x86_fenced_block fenced_block;
  57. #elif defined(__GNUC__) \
  58. && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \
  59. && !defined(__INTEL_COMPILER) && !defined(__ICL) \
  60. && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__)
  61. typedef gcc_sync_fenced_block fenced_block;
  62. #elif defined(BOOST_ASIO_WINDOWS) && !defined(UNDER_CE)
  63. typedef win_fenced_block fenced_block;
  64. #else
  65. typedef null_fenced_block fenced_block;
  66. #endif
  67. } // namespace detail
  68. } // namespace asio
  69. } // namespace boost
  70. #endif // BOOST_ASIO_DETAIL_FENCED_BLOCK_HPP