fence_operations_emulated.hpp 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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) 2020 Andrey Semashev
  7. */
  8. /*!
  9. * \file atomic/detail/fence_operations_emulated.hpp
  10. *
  11. * This header contains implementation of the \c fence_operations struct.
  12. */
  13. #ifndef BOOST_ATOMIC_DETAIL_FENCE_OPERATIONS_EMULATED_HPP_INCLUDED_
  14. #define BOOST_ATOMIC_DETAIL_FENCE_OPERATIONS_EMULATED_HPP_INCLUDED_
  15. #include <boost/memory_order.hpp>
  16. #include <boost/atomic/detail/config.hpp>
  17. #include <boost/atomic/detail/lock_pool.hpp>
  18. #include <boost/atomic/detail/header.hpp>
  19. #ifdef BOOST_HAS_PRAGMA_ONCE
  20. #pragma once
  21. #endif
  22. namespace boost {
  23. namespace atomics {
  24. namespace detail {
  25. //! Fence operations based on lock pool
  26. struct fence_operations_emulated
  27. {
  28. static BOOST_FORCEINLINE void thread_fence(memory_order) BOOST_NOEXCEPT
  29. {
  30. atomics::detail::lock_pool::thread_fence();
  31. }
  32. static BOOST_FORCEINLINE void signal_fence(memory_order) BOOST_NOEXCEPT
  33. {
  34. atomics::detail::lock_pool::signal_fence();
  35. }
  36. };
  37. } // namespace detail
  38. } // namespace atomics
  39. } // namespace boost
  40. #include <boost/atomic/detail/footer.hpp>
  41. #endif // BOOST_ATOMIC_DETAIL_FENCE_OPERATIONS_EMULATED_HPP_INCLUDED_