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) 2011 Helge Bahmann
7 * Copyright (c) 2013 Tim Blechmann
8 * Copyright (c) 2014 Andrey Semashev
11 * \file atomic/fences.hpp
13 * This header contains definition of \c atomic_thread_fence and \c atomic_signal_fence functions.
16 #ifndef BOOST_ATOMIC_FENCES_HPP_INCLUDED_
17 #define BOOST_ATOMIC_FENCES_HPP_INCLUDED_
19 #include <boost/memory_order.hpp>
20 #include <boost/atomic/capabilities.hpp>
21 #include <boost/atomic/detail/operations.hpp>
23 #ifdef BOOST_HAS_PRAGMA_ONCE
28 * IMPLEMENTATION NOTE: All interface functions MUST be declared with BOOST_FORCEINLINE,
29 * see comment for convert_memory_order_to_gcc in ops_gcc_atomic.hpp.
36 #if BOOST_ATOMIC_THREAD_FENCE > 0
37 BOOST_FORCEINLINE void atomic_thread_fence(memory_order order) BOOST_NOEXCEPT
39 detail::thread_fence(order);
42 BOOST_FORCEINLINE void atomic_thread_fence(memory_order) BOOST_NOEXCEPT
44 detail::lockpool::thread_fence();
48 #if BOOST_ATOMIC_SIGNAL_FENCE > 0
49 BOOST_FORCEINLINE void atomic_signal_fence(memory_order order) BOOST_NOEXCEPT
51 detail::signal_fence(order);
54 BOOST_FORCEINLINE void atomic_signal_fence(memory_order) BOOST_NOEXCEPT
56 detail::lockpool::signal_fence();
60 } // namespace atomics
62 using atomics::atomic_thread_fence;
63 using atomics::atomic_signal_fence;
67 #endif // BOOST_ATOMIC_FENCES_HPP_INCLUDED_