Chris@102: /* Chris@102: * Distributed under the Boost Software License, Version 1.0. Chris@102: * (See accompanying file LICENSE_1_0.txt or copy at Chris@102: * http://www.boost.org/LICENSE_1_0.txt) Chris@102: * Chris@102: * Copyright (c) 2011 Helge Bahmann Chris@102: * Copyright (c) 2013 Tim Blechmann Chris@102: * Copyright (c) 2014 Andrey Semashev Chris@102: */ Chris@102: /*! Chris@102: * \file atomic/fences.hpp Chris@102: * Chris@102: * This header contains definition of \c atomic_thread_fence and \c atomic_signal_fence functions. Chris@102: */ Chris@102: Chris@102: #ifndef BOOST_ATOMIC_FENCES_HPP_INCLUDED_ Chris@102: #define BOOST_ATOMIC_FENCES_HPP_INCLUDED_ Chris@102: Chris@102: #include Chris@102: #include Chris@102: #include Chris@102: Chris@102: #ifdef BOOST_HAS_PRAGMA_ONCE Chris@102: #pragma once Chris@102: #endif Chris@102: Chris@102: /* Chris@102: * IMPLEMENTATION NOTE: All interface functions MUST be declared with BOOST_FORCEINLINE, Chris@102: * see comment for convert_memory_order_to_gcc in ops_gcc_atomic.hpp. Chris@102: */ Chris@102: Chris@102: namespace boost { Chris@102: Chris@102: namespace atomics { Chris@102: Chris@102: #if BOOST_ATOMIC_THREAD_FENCE > 0 Chris@102: BOOST_FORCEINLINE void atomic_thread_fence(memory_order order) BOOST_NOEXCEPT Chris@102: { Chris@102: detail::thread_fence(order); Chris@102: } Chris@102: #else Chris@102: BOOST_FORCEINLINE void atomic_thread_fence(memory_order) BOOST_NOEXCEPT Chris@102: { Chris@102: detail::lockpool::thread_fence(); Chris@102: } Chris@102: #endif Chris@102: Chris@102: #if BOOST_ATOMIC_SIGNAL_FENCE > 0 Chris@102: BOOST_FORCEINLINE void atomic_signal_fence(memory_order order) BOOST_NOEXCEPT Chris@102: { Chris@102: detail::signal_fence(order); Chris@102: } Chris@102: #else Chris@102: BOOST_FORCEINLINE void atomic_signal_fence(memory_order) BOOST_NOEXCEPT Chris@102: { Chris@102: detail::lockpool::signal_fence(); Chris@102: } Chris@102: #endif Chris@102: Chris@102: } // namespace atomics Chris@102: Chris@102: using atomics::atomic_thread_fence; Chris@102: using atomics::atomic_signal_fence; Chris@102: Chris@102: } // namespace boost Chris@102: Chris@102: #endif // BOOST_ATOMIC_FENCES_HPP_INCLUDED_