1 #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED
2 #define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED
5 // boost/detail/atomic_count_sync.hpp
7 // atomic_count for g++ 4.1+
9 // http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html
11 // Copyright 2007 Peter Dimov
13 // Distributed under the Boost Software License, Version 1.0. (See
14 // accompanying file LICENSE_1_0.txt or copy at
15 // http://www.boost.org/LICENSE_1_0.txt)
18 #if defined( __ia64__ ) && defined( __INTEL_COMPILER )
19 # include <ia64intrin.h>
32 explicit atomic_count( long v ) : value_( v ) {}
36 return __sync_add_and_fetch( &value_, 1 );
41 return __sync_add_and_fetch( &value_, -1 );
46 return __sync_fetch_and_add( &value_, 0 );
51 atomic_count(atomic_count const &);
52 atomic_count & operator=(atomic_count const &);
61 #endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED