fences.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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) 2011 Helge Bahmann
  7. * Copyright (c) 2013 Tim Blechmann
  8. * Copyright (c) 2014 Andrey Semashev
  9. */
  10. /*!
  11. * \file atomic/fences.hpp
  12. *
  13. * This header contains definition of \c atomic_thread_fence and \c atomic_signal_fence functions.
  14. */
  15. #ifndef BOOST_ATOMIC_FENCES_HPP_INCLUDED_
  16. #define BOOST_ATOMIC_FENCES_HPP_INCLUDED_
  17. #include <boost/memory_order.hpp>
  18. #include <boost/atomic/capabilities.hpp>
  19. #include <boost/atomic/detail/fence_operations.hpp>
  20. #include <boost/atomic/detail/header.hpp>
  21. #ifdef BOOST_HAS_PRAGMA_ONCE
  22. #pragma once
  23. #endif
  24. /*
  25. * IMPLEMENTATION NOTE: All interface functions MUST be declared with BOOST_FORCEINLINE,
  26. * see comment for convert_memory_order_to_gcc in gcc_atomic_memory_order_utils.hpp.
  27. */
  28. namespace boost {
  29. namespace atomics {
  30. BOOST_FORCEINLINE void atomic_thread_fence(memory_order order) BOOST_NOEXCEPT
  31. {
  32. atomics::detail::fence_operations::thread_fence(order);
  33. }
  34. BOOST_FORCEINLINE void atomic_signal_fence(memory_order order) BOOST_NOEXCEPT
  35. {
  36. atomics::detail::fence_operations::signal_fence(order);
  37. }
  38. } // namespace atomics
  39. using atomics::atomic_thread_fence;
  40. using atomics::atomic_signal_fence;
  41. } // namespace boost
  42. #include <boost/atomic/detail/footer.hpp>
  43. #endif // BOOST_ATOMIC_FENCES_HPP_INCLUDED_