atomic_count_solaris.hpp
Go to the documentation of this file.
00001 #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED
00002 #define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED
00003 
00004 //
00005 //  boost/detail/atomic_count_solaris.hpp
00006 //   based on: boost/detail/atomic_count_win32.hpp
00007 //
00008 //  Copyright (c) 2001-2005 Peter Dimov
00009 //  Copyright (c) 2006 Michael van der Westhuizen
00010 //
00011 // Distributed under the Boost Software License, Version 1.0. (See
00012 // accompanying file LICENSE_1_0.txt or copy at
00013 // http://www.boost.org/LICENSE_1_0.txt)
00014 //
00015 
00016 #include <atomic.h>
00017 
00018 namespace boost
00019 {
00020 
00021 namespace detail
00022 {
00023 
00024 class atomic_count
00025 {
00026 public:
00027 
00028     explicit atomic_count( uint32_t v ): value_( v )
00029     {
00030     }
00031 
00032     long operator++()
00033     {
00034         return atomic_inc_32_nv( &value_ );
00035     }
00036 
00037     long operator--()
00038     {
00039         return atomic_dec_32_nv( &value_ );
00040     }
00041 
00042     operator uint32_t() const
00043     {
00044         return static_cast<uint32_t const volatile &>( value_ );
00045     }
00046 
00047 private:
00048 
00049     atomic_count( atomic_count const & );
00050     atomic_count & operator=( atomic_count const & );
00051 
00052     uint32_t value_;
00053 };
00054 
00055 } // namespace detail
00056 
00057 } // namespace boost
00058 
00059 #endif // #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED


appl
Author(s): petercai
autogenerated on Tue Jan 7 2014 11:02:28