1 #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_ATOMIC_HPP_INCLUDED
2 #define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_ATOMIC_HPP_INCLUDED
4 // boost/detail/atomic_count_gcc_atomic.hpp
6 // atomic_count for g++ 4.7+
8 // Copyright 2007, 2020 Peter Dimov
10 // Distributed under the Boost Software License, Version 1.0.
11 // https://www.boost.org/LICENSE_1_0.txt
13 #include <boost/cstdint.hpp>
15 #if defined(BOOST_SP_REPORT_IMPLEMENTATION)
17 #include <boost/config/pragma_message.hpp>
18 BOOST_PRAGMA_MESSAGE("Using __atomic atomic_count")
32 explicit atomic_count( long v ): value_( static_cast< boost::int_least32_t >( v ) )
38 return __atomic_add_fetch( &value_, +1, __ATOMIC_ACQ_REL );
43 return __atomic_add_fetch( &value_, -1, __ATOMIC_ACQ_REL );
48 return __atomic_load_n( &value_, __ATOMIC_ACQUIRE );
53 atomic_count(atomic_count const &);
54 atomic_count & operator=(atomic_count const &);
56 boost::int_least32_t value_;
63 #endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_GCC_ATOMIC_HPP_INCLUDED