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)
6 * Copyright (c) 2020 Andrey Semashev
9 * \file atomic/detail/fence_ops_gcc_sync.hpp
11 * This header contains implementation of the \c fence_operations struct.
14 #ifndef BOOST_ATOMIC_DETAIL_FENCE_OPS_GCC_SYNC_HPP_INCLUDED_
15 #define BOOST_ATOMIC_DETAIL_FENCE_OPS_GCC_SYNC_HPP_INCLUDED_
17 #include <boost/memory_order.hpp>
18 #include <boost/atomic/detail/config.hpp>
19 #include <boost/atomic/detail/header.hpp>
21 #ifdef BOOST_HAS_PRAGMA_ONCE
29 //! Fence operations based on gcc __sync* intrinsics
30 struct fence_operations_gcc_sync
32 static BOOST_FORCEINLINE void thread_fence(memory_order order) BOOST_NOEXCEPT
34 if (order != memory_order_relaxed)
38 static BOOST_FORCEINLINE void signal_fence(memory_order order) BOOST_NOEXCEPT
40 if (order != memory_order_relaxed)
41 __asm__ __volatile__ ("" ::: "memory");
45 typedef fence_operations_gcc_sync fence_operations;
48 } // namespace atomics
51 #include <boost/atomic/detail/footer.hpp>
53 #endif // BOOST_ATOMIC_DETAIL_FENCE_OPS_GCC_SYNC_HPP_INCLUDED_