]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/boost/math/tools/atomic.hpp
update sources to v12.2.3
[ceph.git] / ceph / src / boost / boost / math / tools / atomic.hpp
1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright 2017 John Maddock
3 // Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6
7 #ifndef BOOST_MATH_ATOMIC_DETAIL_HPP
8 #define BOOST_MATH_ATOMIC_DETAIL_HPP
9
10 #include <boost/config.hpp>
11
12 #ifdef BOOST_HAS_THREADS
13
14 #ifndef BOOST_NO_CXX11_HDR_ATOMIC
15 # include <atomic>
16 # define BOOST_MATH_ATOMIC_NS std
17 namespace boost {
18 namespace math {
19 namespace detail {
20 #if ATOMIC_INT_LOCK_FREE == 2
21 typedef std::atomic<int> atomic_counter_type;
22 typedef std::atomic<unsigned> atomic_unsigned_type;
23 typedef int atomic_integer_type;
24 typedef unsigned atomic_unsigned_integer_type;
25 #elif ATOMIC_SHORT_LOCK_FREE == 2
26 typedef std::atomic<short> atomic_counter_type;
27 typedef std::atomic<unsigned short> atomic_unsigned_type;
28 typedef short atomic_integer_type;
29 typedef unsigned short atomic_unsigned_type;
30 #elif ATOMIC_LONG_LOCK_FREE == 2
31 typedef std::atomic<long> atomic_unsigned_integer_type;
32 typedef std::atomic<unsigned long> atomic_unsigned_type;
33 typedef unsigned long atomic_unsigned_type;
34 typedef long atomic_integer_type;
35 #elif ATOMIC_LLONG_LOCK_FREE == 2
36 typedef std::atomic<long long> atomic_unsigned_integer_type;
37 typedef std::atomic<unsigned long long> atomic_unsigned_type;
38 typedef long long atomic_integer_type;
39 typedef unsigned long long atomic_unsigned_integer_type;
40 #else
41 # define BOOST_MATH_NO_ATOMIC_INT
42 #endif
43 }
44 }}
45 #else // BOOST_NO_CXX11_HDR_ATOMIC
46 //
47 // We need Boost.Atomic, but on any platform that supports auto-linking we do
48 // not need to link against a separate library:
49 //
50 #define BOOST_ATOMIC_NO_LIB
51 #include <boost/atomic.hpp>
52 # define BOOST_MATH_ATOMIC_NS boost
53
54 namespace boost{ namespace math{ namespace detail{
55
56 //
57 // We need a type to use as an atomic counter:
58 //
59 #if BOOST_ATOMIC_INT_LOCK_FREE == 2
60 typedef boost::atomic<int> atomic_counter_type;
61 typedef boost::atomic<unsigned> atomic_unsigned_type;
62 typedef int atomic_integer_type;
63 typedef unsigned atomic_unsigned_integer_type;
64 #elif BOOST_ATOMIC_SHORT_LOCK_FREE == 2
65 typedef boost::atomic<short> atomic_counter_type;
66 typedef boost::atomic<unsigned short> atomic_unsigned_type;
67 typedef short atomic_integer_type;
68 typedef unsigned short atomic_unsigned_integer_type;
69 #elif BOOST_ATOMIC_LONG_LOCK_FREE == 2
70 typedef boost::atomic<long> atomic_counter_type;
71 typedef boost::atomic<unsigned long> atomic_unsigned_type;
72 typedef long atomic_integer_type;
73 typedef unsigned long atomic_unsigned_integer_type;
74 #elif BOOST_ATOMIC_LLONG_LOCK_FREE == 2
75 typedef boost::atomic<long long> atomic_counter_type;
76 typedef boost::atomic<unsigned long long> atomic_unsigned_type;
77 typedef long long atomic_integer_type;
78 typedef unsigned long long atomic_unsigned_integer_type;
79 #else
80 # define BOOST_MATH_NO_ATOMIC_INT
81 #endif
82
83 }}} // namespaces
84
85 #endif // BOOST_NO_CXX11_HDR_ATOMIC
86
87 #else // BOOST_HAS_THREADS
88
89 # define BOOST_MATH_NO_ATOMIC_INT
90
91 #endif // BOOST_HAS_THREADS
92
93 #endif // BOOST_MATH_ATOMIC_DETAIL_HPP