Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:51:42

0001 #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_NT_HPP_INCLUDED
0002 #define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_NT_HPP_INCLUDED
0003 
0004 //
0005 //  boost/detail/atomic_count_nt.hpp
0006 //
0007 //  Trivial atomic_count for the single-threaded case
0008 //
0009 //  http://gcc.gnu.org/onlinedocs/porting/Thread-safety.html
0010 //
0011 //  Copyright 2013 Peter Dimov
0012 //
0013 //  Distributed under the Boost Software License, Version 1.0.
0014 //  See accompanying file LICENSE_1_0.txt or copy at
0015 //  http://www.boost.org/LICENSE_1_0.txt
0016 //
0017 
0018 #if defined(BOOST_SP_REPORT_IMPLEMENTATION)
0019 
0020 #include <boost/config/pragma_message.hpp>
0021 BOOST_PRAGMA_MESSAGE("Using single-threaded, non-atomic atomic_count")
0022 
0023 #endif
0024 
0025 namespace boost
0026 {
0027 
0028 namespace detail
0029 {
0030 
0031 class atomic_count
0032 {
0033 public:
0034 
0035     explicit atomic_count( long v ): value_( v )
0036     {
0037     }
0038 
0039     long operator++()
0040     {
0041         return ++value_;
0042     }
0043 
0044     long operator--()
0045     {
0046         return --value_;
0047     }
0048 
0049     operator long() const
0050     {
0051         return value_;
0052     }
0053 
0054 private:
0055 
0056     atomic_count(atomic_count const &);
0057     atomic_count & operator=(atomic_count const &);
0058 
0059     long value_;
0060 };
0061 
0062 } // namespace detail
0063 
0064 } // namespace boost
0065 
0066 #endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_NT_HPP_INCLUDED