ops_msvc_common.hpp 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * Distributed under the Boost Software License, Version 1.0.
  3. * (See accompanying file LICENSE_1_0.txt or copy at
  4. * http://www.boost.org/LICENSE_1_0.txt)
  5. *
  6. * Copyright (c) 2009 Helge Bahmann
  7. * Copyright (c) 2012 Tim Blechmann
  8. * Copyright (c) 2014 Andrey Semashev
  9. */
  10. /*!
  11. * \file atomic/detail/ops_msvc_common.hpp
  12. *
  13. * This header contains common tools for MSVC implementation of the \c operations template.
  14. */
  15. #ifndef BOOST_ATOMIC_DETAIL_OPS_MSVC_COMMON_HPP_INCLUDED_
  16. #define BOOST_ATOMIC_DETAIL_OPS_MSVC_COMMON_HPP_INCLUDED_
  17. #include <boost/atomic/detail/config.hpp>
  18. #ifdef BOOST_HAS_PRAGMA_ONCE
  19. #pragma once
  20. #endif
  21. // Define compiler barriers
  22. #if defined(__INTEL_COMPILER)
  23. #define BOOST_ATOMIC_DETAIL_COMPILER_BARRIER() __memory_barrier()
  24. #elif defined(_MSC_VER) && !defined(_WIN32_WCE)
  25. extern "C" void _ReadWriteBarrier(void);
  26. #pragma intrinsic(_ReadWriteBarrier)
  27. #define BOOST_ATOMIC_DETAIL_COMPILER_BARRIER() _ReadWriteBarrier()
  28. #endif
  29. #ifndef BOOST_ATOMIC_DETAIL_COMPILER_BARRIER
  30. #define BOOST_ATOMIC_DETAIL_COMPILER_BARRIER()
  31. #endif
  32. #endif // BOOST_ATOMIC_DETAIL_OPS_MSVC_COMMON_HPP_INCLUDED_