1 #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED
2 #define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED
3 
4 //
5 //  boost/detail/atomic_count_solaris.hpp
6 //   based on: boost/detail/atomic_count_win32.hpp
7 //
8 //  Copyright (c) 2001-2005 Peter Dimov
9 //  Copyright (c) 2006 Michael van der Westhuizen
10 //
11 // Distributed under the Boost Software License, Version 1.0. (See
12 // accompanying file LICENSE_1_0.txt or copy at
13 // http://www.boost.org/LICENSE_1_0.txt)
14 //
15 
16 #include <atomic.h>
17 
18 namespace boost
19 {
20 
21 namespace detail
22 {
23 
24 class atomic_count
25 {
26 public:
27 
atomic_count(uint32_t v)28     explicit atomic_count( uint32_t v ): value_( v )
29     {
30     }
31 
operator ++()32     long operator++()
33     {
34         return atomic_inc_32_nv( &value_ );
35     }
36 
operator --()37     long operator--()
38     {
39         return atomic_dec_32_nv( &value_ );
40     }
41 
operator uint32_t() const42     operator uint32_t() const
43     {
44         return static_cast<uint32_t const volatile &>( value_ );
45     }
46 
47 private:
48 
49     atomic_count( atomic_count const & );
50     atomic_count & operator=( atomic_count const & );
51 
52     uint32_t value_;
53 };
54 
55 } // namespace detail
56 
57 } // namespace boost
58 
59 #endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED
60