fence_arch_ops_gcc_alpha.hpp 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  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_arch_ops_gcc_alpha.hpp
  10. *
  11. * This header contains implementation of the \c fence_arch_operations struct.
  12. */
  13. #ifndef BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_GCC_ALPHA_HPP_INCLUDED_
  14. #define BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_GCC_ALPHA_HPP_INCLUDED_
  15. #include <boost/memory_order.hpp>
  16. #include <boost/atomic/detail/config.hpp>
  17. #include <boost/atomic/detail/header.hpp>
  18. #ifdef BOOST_HAS_PRAGMA_ONCE
  19. #pragma once
  20. #endif
  21. namespace boost {
  22. namespace atomics {
  23. namespace detail {
  24. //! Fence operations for Alpha
  25. struct fence_arch_operations_gcc_alpha
  26. {
  27. static BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
  28. {
  29. if (order != memory_order_relaxed)
  30. __asm__ __volatile__ ("mb" ::: "memory");
  31. }
  32. static BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
  33. {
  34. if (order != memory_order_relaxed)
  35. __asm__ __volatile__ ("" ::: "memory");
  36. }
  37. };
  38. typedef fence_arch_operations_gcc_alpha fence_arch_operations;
  39. } // namespace detail
  40. } // namespace atomics
  41. } // namespace boost
  42. #include <boost/atomic/detail/footer.hpp>
  43. #endif // BOOST_ATOMIC_DETAIL_FENCE_ARCH_OPS_GCC_ALPHA_HPP_INCLUDED_