epoc32/include/stdapis/boost/detail/atomic_count_win32.hpp
branchSymbian2
changeset 2 2fe1408b6811
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/epoc32/include/stdapis/boost/detail/atomic_count_win32.hpp	Tue Mar 16 16:12:26 2010 +0000
     1.3 @@ -0,0 +1,63 @@
     1.4 +#ifndef BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED
     1.5 +#define BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED
     1.6 +
     1.7 +// MS compatible compilers support #pragma once
     1.8 +
     1.9 +#if defined(_MSC_VER) && (_MSC_VER >= 1020)
    1.10 +# pragma once
    1.11 +#endif
    1.12 +
    1.13 +//
    1.14 +//  boost/detail/atomic_count_win32.hpp
    1.15 +//
    1.16 +//  Copyright (c) 2001-2005 Peter Dimov
    1.17 +//
    1.18 +// Distributed under the Boost Software License, Version 1.0. (See
    1.19 +// accompanying file LICENSE_1_0.txt or copy at
    1.20 +// http://www.boost.org/LICENSE_1_0.txt)
    1.21 +//
    1.22 +
    1.23 +#include <boost/detail/interlocked.hpp>
    1.24 +
    1.25 +namespace boost
    1.26 +{
    1.27 +
    1.28 +namespace detail
    1.29 +{
    1.30 +
    1.31 +class atomic_count
    1.32 +{
    1.33 +public:
    1.34 +
    1.35 +    explicit atomic_count( long v ): value_( v )
    1.36 +    {
    1.37 +    }
    1.38 +
    1.39 +    long operator++()
    1.40 +    {
    1.41 +        return BOOST_INTERLOCKED_INCREMENT( &value_ );
    1.42 +    }
    1.43 +
    1.44 +    long operator--()
    1.45 +    {
    1.46 +        return BOOST_INTERLOCKED_DECREMENT( &value_ );
    1.47 +    }
    1.48 +
    1.49 +    operator long() const
    1.50 +    {
    1.51 +        return static_cast<long const volatile &>( value_ );
    1.52 +    }
    1.53 +
    1.54 +private:
    1.55 +
    1.56 +    atomic_count( atomic_count const & );
    1.57 +    atomic_count & operator=( atomic_count const & );
    1.58 +
    1.59 +    long value_;
    1.60 +};
    1.61 +
    1.62 +} // namespace detail
    1.63 +
    1.64 +} // namespace boost
    1.65 +
    1.66 +#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED