1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- #ifndef BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED
- #define BOOST_SMART_PTR_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED
- #include <atomic.h>
- namespace boost
- {
- namespace detail
- {
- class atomic_count
- {
- public:
- explicit atomic_count( uint32_t v ): value_( v )
- {
- }
- long operator++()
- {
- return atomic_inc_32_nv( &value_ );
- }
- long operator--()
- {
- return atomic_dec_32_nv( &value_ );
- }
- operator uint32_t() const
- {
- return static_cast<uint32_t const volatile &>( value_ );
- }
- private:
- atomic_count( atomic_count const & );
- atomic_count & operator=( atomic_count const & );
- uint32_t value_;
- };
- }
- }
- #endif
|