annotate DEPENDENCIES/generic/include/boost/smart_ptr/detail/atomic_count_spin.hpp @ 133:4acb5d8d80b6 tip

Don't fail environmental check if README.md exists (but .txt and no-suffix don't)
author Chris Cannam
date Tue, 30 Jul 2019 12:25:44 +0100
parents f46d142149f5
children
rev   line source
Chris@102 1 #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SPIN_HPP_INCLUDED
Chris@102 2 #define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SPIN_HPP_INCLUDED
Chris@102 3
Chris@102 4 //
Chris@102 5 // boost/detail/atomic_count_spin.hpp
Chris@102 6 //
Chris@102 7 // Copyright (c) 2013 Peter Dimov
Chris@102 8 //
Chris@102 9 // Distributed under the Boost Software License, Version 1.0.
Chris@102 10 // See accompanying file LICENSE_1_0.txt or copy at
Chris@102 11 // http://www.boost.org/LICENSE_1_0.txt
Chris@102 12 //
Chris@102 13
Chris@102 14 #include <boost/smart_ptr/detail/spinlock_pool.hpp>
Chris@102 15
Chris@102 16 namespace boost
Chris@102 17 {
Chris@102 18
Chris@102 19 namespace detail
Chris@102 20 {
Chris@102 21
Chris@102 22 class atomic_count
Chris@102 23 {
Chris@102 24 private:
Chris@102 25
Chris@102 26 public:
Chris@102 27
Chris@102 28 explicit atomic_count( long v ): value_( v )
Chris@102 29 {
Chris@102 30 }
Chris@102 31
Chris@102 32 long operator++()
Chris@102 33 {
Chris@102 34 spinlock_pool<0>::scoped_lock lock( &value_ );
Chris@102 35 return ++value_;
Chris@102 36 }
Chris@102 37
Chris@102 38 long operator--()
Chris@102 39 {
Chris@102 40 spinlock_pool<0>::scoped_lock lock( &value_ );
Chris@102 41 return --value_;
Chris@102 42 }
Chris@102 43
Chris@102 44 operator long() const
Chris@102 45 {
Chris@102 46 spinlock_pool<0>::scoped_lock lock( &value_ );
Chris@102 47 return value_;
Chris@102 48 }
Chris@102 49
Chris@102 50 private:
Chris@102 51
Chris@102 52 atomic_count(atomic_count const &);
Chris@102 53 atomic_count & operator=(atomic_count const &);
Chris@102 54
Chris@102 55 long value_;
Chris@102 56 };
Chris@102 57
Chris@102 58 } // namespace detail
Chris@102 59
Chris@102 60 } // namespace boost
Chris@102 61
Chris@102 62 #endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SPIN_HPP_INCLUDED