1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71
|
// atomic.hpp: pull in std::atomic or boost::atomic
//
// Copyright (C) 2013 Tim Blechmann
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#ifndef BOOST_SYNC_DETAIL_ATOMIC_HPP
#define BOOST_SYNC_DETAIL_ATOMIC_HPP
#include <boost/sync/detail/config.hpp>
#if !defined(BOOST_SYNC_USE_STD_ATOMIC)
#if defined(BOOST_CLANG)
// Clang can be used with libstdc++, which only enables C++11 headers when explicitly enabled in the command line.
#if (__cplusplus >= 201103L) && __has_include( <atomic> )
#define BOOST_SYNC_USE_STD_ATOMIC
#endif
#elif defined(BOOST_MSVC)
#if (BOOST_MSVC >= 1700)
#define BOOST_SYNC_USE_STD_ATOMIC
#endif
#elif defined(BOOST_GCC)
#if (BOOST_GCC >= 40800) && (__cplusplus >= 201103L)
#define BOOST_SYNC_USE_STD_ATOMIC
#endif
#endif
#endif // !defined(BOOST_SYNC_USE_STD_ATOMIC)
#ifdef BOOST_SYNC_USE_STD_ATOMIC
#include <atomic>
#else
#include <boost/atomic.hpp>
#endif
#include <boost/sync/detail/header.hpp>
#ifdef BOOST_HAS_PRAGMA_ONCE
#pragma once
#endif
namespace boost {
namespace sync {
namespace detail {
#ifdef BOOST_SYNC_USE_STD_ATOMIC
namespace atomic_ns = std;
#else
namespace atomic_ns = boost;
#endif
}
}
}
#include <boost/sync/detail/footer.hpp>
#endif // BOOST_SYNC_DETAIL_ATOMIC_HPP
|