summaryrefslogtreecommitdiff
path: root/boost/lockfree/detail/atomic.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/lockfree/detail/atomic.hpp')
-rw-r--r--boost/lockfree/detail/atomic.hpp62
1 files changed, 62 insertions, 0 deletions
diff --git a/boost/lockfree/detail/atomic.hpp b/boost/lockfree/detail/atomic.hpp
new file mode 100644
index 0000000000..f36ad4b6d5
--- /dev/null
+++ b/boost/lockfree/detail/atomic.hpp
@@ -0,0 +1,62 @@
+// Copyright (C) 2011-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_LOCKFREE_DETAIL_ATOMIC_HPP
+#define BOOST_LOCKFREE_DETAIL_ATOMIC_HPP
+
+#include <boost/config.hpp>
+
+#ifndef BOOST_LOCKFREE_FORCE_STD_ATOMIC
+
+#define BOOST_LOCKFREE_NO_HDR_ATOMIC
+
+// MSVC supports atomic<> from version 2012 onwards.
+#if defined(BOOST_MSVC) && (BOOST_MSVC >= 1700)
+#undef BOOST_LOCKFREE_NO_HDR_ATOMIC
+#endif
+
+// GCC supports atomic<> from version 4.8 onwards.
+#if (BOOST_GCC >= 40800) && (__cplusplus >= 201103L)
+#undef BOOST_LOCKFREE_NO_HDR_ATOMIC
+#endif
+
+#endif // BOOST_LOCKFREE_FORCE_STD_ATOMIC
+
+
+#if defined(BOOST_LOCKFREE_NO_HDR_ATOMIC)
+#include <boost/atomic.hpp>
+#else
+#include <atomic>
+#endif
+
+namespace boost {
+namespace lockfree {
+namespace detail {
+
+#if defined(BOOST_LOCKFREE_NO_HDR_ATOMIC)
+using boost::atomic;
+using boost::memory_order_acquire;
+using boost::memory_order_consume;
+using boost::memory_order_relaxed;
+using boost::memory_order_release;
+#else
+using std::atomic;
+using std::memory_order_acquire;
+using std::memory_order_consume;
+using std::memory_order_relaxed;
+using std::memory_order_release;
+#endif
+
+}
+using detail::atomic;
+using detail::memory_order_acquire;
+using detail::memory_order_consume;
+using detail::memory_order_relaxed;
+using detail::memory_order_release;
+
+}}
+
+#endif /* BOOST_LOCKFREE_DETAIL_ATOMIC_HPP */