00001 #ifndef BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED
00002 #define BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED
00003
00004 #if _MSC_VER >= 1020
00005 #pragma once
00006 #endif
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <sysc/packages/boost/detail/winapi.hpp>
00020
00021 namespace boost
00022 {
00023
00024 namespace detail
00025 {
00026
00027 class atomic_count
00028 {
00029 public:
00030
00031 explicit atomic_count(long v): value_(v)
00032 {
00033 }
00034
00035 long operator++()
00036 {
00037 return winapi::InterlockedIncrement(&value_);
00038 }
00039
00040 long operator--()
00041 {
00042 return winapi::InterlockedDecrement(&value_);
00043 }
00044
00045 operator long() const
00046 {
00047 return value_;
00048 }
00049
00050 private:
00051
00052 atomic_count(atomic_count const &);
00053 atomic_count & operator=(atomic_count const &);
00054
00055 volatile long value_;
00056 };
00057
00058 }
00059
00060 }
00061
00062 #endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED