• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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) 2011 Helge Bahmann
7  * Copyright (c) 2013 Tim Blechmann
8  * Copyright (c) 2014 Andrey Semashev
9  */
10 /*!
11  * \file   atomic/fences.hpp
12  *
13  * This header contains definition of \c atomic_thread_fence and \c atomic_signal_fence functions.
14  */
15 
16 #ifndef BOOST_ATOMIC_FENCES_HPP_INCLUDED_
17 #define BOOST_ATOMIC_FENCES_HPP_INCLUDED_
18 
19 #include <boost/memory_order.hpp>
20 #include <boost/atomic/capabilities.hpp>
21 #include <boost/atomic/detail/fence_operations.hpp>
22 #include <boost/atomic/detail/header.hpp>
23 
24 #ifdef BOOST_HAS_PRAGMA_ONCE
25 #pragma once
26 #endif
27 
28 /*
29  * IMPLEMENTATION NOTE: All interface functions MUST be declared with BOOST_FORCEINLINE,
30  *                      see comment for convert_memory_order_to_gcc in gcc_atomic_memory_order_utils.hpp.
31  */
32 
33 namespace boost {
34 
35 namespace atomics {
36 
atomic_thread_fence(memory_order order)37 BOOST_FORCEINLINE void atomic_thread_fence(memory_order order) BOOST_NOEXCEPT
38 {
39     atomics::detail::fence_operations::thread_fence(order);
40 }
41 
atomic_signal_fence(memory_order order)42 BOOST_FORCEINLINE void atomic_signal_fence(memory_order order) BOOST_NOEXCEPT
43 {
44     atomics::detail::fence_operations::signal_fence(order);
45 }
46 
47 } // namespace atomics
48 
49 using atomics::atomic_thread_fence;
50 using atomics::atomic_signal_fence;
51 
52 } // namespace boost
53 
54 #include <boost/atomic/detail/footer.hpp>
55 
56 #endif // BOOST_ATOMIC_FENCES_HPP_INCLUDED_
57