]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/atomic/include/boost/atomic/fences.hpp
add subtree-ish sources for 12.0.3
[ceph.git] / ceph / src / boost / libs / atomic / include / boost / atomic / fences.hpp
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/operations.hpp>
22
23 #ifdef BOOST_HAS_PRAGMA_ONCE
24 #pragma once
25 #endif
26
27 /*
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.
30 */
31
32 namespace boost {
33
34 namespace atomics {
35
36 #if BOOST_ATOMIC_THREAD_FENCE > 0
37 BOOST_FORCEINLINE void atomic_thread_fence(memory_order order) BOOST_NOEXCEPT
38 {
39 detail::thread_fence(order);
40 }
41 #else
42 BOOST_FORCEINLINE void atomic_thread_fence(memory_order) BOOST_NOEXCEPT
43 {
44 detail::lockpool::thread_fence();
45 }
46 #endif
47
48 #if BOOST_ATOMIC_SIGNAL_FENCE > 0
49 BOOST_FORCEINLINE void atomic_signal_fence(memory_order order) BOOST_NOEXCEPT
50 {
51 detail::signal_fence(order);
52 }
53 #else
54 BOOST_FORCEINLINE void atomic_signal_fence(memory_order) BOOST_NOEXCEPT
55 {
56 detail::lockpool::signal_fence();
57 }
58 #endif
59
60 } // namespace atomics
61
62 using atomics::atomic_thread_fence;
63 using atomics::atomic_signal_fence;
64
65 } // namespace boost
66
67 #endif // BOOST_ATOMIC_FENCES_HPP_INCLUDED_