1 #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED
2 #define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED
4 // MS compatible compilers support #pragma once
6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
11 // boost/detail/atomic_count.hpp - thread/SMP safe reference counter
13 // Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
14 // Copyright (c) 2013 Peter Dimov
16 // Distributed under the Boost Software License, Version 1.0.
17 // See accompanying file LICENSE_1_0.txt or copy at
18 // http://www.boost.org/LICENSE_1_0.txt
20 // typedef <implementation-defined> boost::detail::atomic_count;
24 // (n is convertible to long)
26 // Effects: Constructs an atomic_count with an initial value of n
30 // Returns: (long) the current value of a
31 // Memory Ordering: acquire
35 // Effects: Atomically increments the value of a
36 // Returns: (long) the new value of a
37 // Memory Ordering: acquire/release
41 // Effects: Atomically decrements the value of a
42 // Returns: (long) the new value of a
43 // Memory Ordering: acquire/release
46 #include <boost/config.hpp>
47 #include <boost/smart_ptr/detail/sp_has_sync.hpp>
49 #if defined( BOOST_AC_DISABLE_THREADS )
50 # include <boost/smart_ptr/detail/atomic_count_nt.hpp>
52 #elif defined( BOOST_AC_USE_STD_ATOMIC )
53 # include <boost/smart_ptr/detail/atomic_count_std_atomic.hpp>
55 #elif defined( BOOST_AC_USE_SPINLOCK )
56 # include <boost/smart_ptr/detail/atomic_count_spin.hpp>
58 #elif defined( BOOST_AC_USE_PTHREADS )
59 # include <boost/smart_ptr/detail/atomic_count_pt.hpp>
61 #elif defined( BOOST_SP_DISABLE_THREADS )
62 # include <boost/smart_ptr/detail/atomic_count_nt.hpp>
64 #elif defined( BOOST_SP_USE_STD_ATOMIC )
65 # include <boost/smart_ptr/detail/atomic_count_std_atomic.hpp>
67 #elif defined( BOOST_SP_USE_SPINLOCK )
68 # include <boost/smart_ptr/detail/atomic_count_spin.hpp>
70 #elif defined( BOOST_SP_USE_PTHREADS )
71 # include <boost/smart_ptr/detail/atomic_count_pt.hpp>
73 #elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 )
74 # include <boost/smart_ptr/detail/atomic_count_nt.hpp>
76 #elif !defined( BOOST_NO_CXX11_HDR_ATOMIC )
77 # include <boost/smart_ptr/detail/atomic_count_std_atomic.hpp>
79 #elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined( __PATHSCALE__ )
80 # include <boost/smart_ptr/detail/atomic_count_gcc_x86.hpp>
82 #elif defined( BOOST_SP_HAS_SYNC )
83 # include <boost/smart_ptr/detail/atomic_count_sync.hpp>
85 #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
86 # include <boost/smart_ptr/detail/atomic_count_win32.hpp>
88 #elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
89 # include <boost/smart_ptr/detail/atomic_count_gcc.hpp>
91 #elif !defined( BOOST_HAS_THREADS )
92 # include <boost/smart_ptr/detail/atomic_count_nt.hpp>
95 # include <boost/smart_ptr/detail/atomic_count_spin.hpp>
99 #endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_HPP_INCLUDED