51 lines · plain
1///////////////////////////////////////////////////////////////////////////////2// Copyright 2017 John Maddock3// Distributed under the Boost4// Software License, Version 1.0. (See accompanying file5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)6 7#ifndef BOOST_MATH_ATOMIC_DETAIL_HPP8#define BOOST_MATH_ATOMIC_DETAIL_HPP9 10#include <boost/math/tools/config.hpp>11#include <boost/math/tools/cxx03_warn.hpp>12 13#ifdef BOOST_MATH_HAS_THREADS14#include <atomic>15 16namespace boost {17 namespace math {18 namespace detail {19#if (ATOMIC_INT_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)20 typedef std::atomic<int> atomic_counter_type;21 typedef std::atomic<unsigned> atomic_unsigned_type;22 typedef int atomic_integer_type;23 typedef unsigned atomic_unsigned_integer_type;24#elif (ATOMIC_SHORT_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)25 typedef std::atomic<short> atomic_counter_type;26 typedef std::atomic<unsigned short> atomic_unsigned_type;27 typedef short atomic_integer_type;28 typedef unsigned short atomic_unsigned_type;29#elif (ATOMIC_LONG_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)30 typedef std::atomic<long> atomic_unsigned_integer_type;31 typedef std::atomic<unsigned long> atomic_unsigned_type;32 typedef unsigned long atomic_unsigned_type;33 typedef long atomic_integer_type;34#elif (ATOMIC_LLONG_LOCK_FREE == 2) && !defined(BOOST_MATH_NO_ATOMIC_INT)35 typedef std::atomic<long long> atomic_unsigned_integer_type;36 typedef std::atomic<unsigned long long> atomic_unsigned_type;37 typedef long long atomic_integer_type;38 typedef unsigned long long atomic_unsigned_integer_type;39#elif !defined(BOOST_MATH_NO_ATOMIC_INT)40# define BOOST_MATH_NO_ATOMIC_INT41#endif42 } // Namespace detail43 } // Namespace math44} // Namespace boost45 46#else47# define BOOST_MATH_NO_ATOMIC_INT48#endif // BOOST_MATH_HAS_THREADS49 50#endif // BOOST_MATH_ATOMIC_DETAIL_HPP51