00001 #ifndef _posix_AtomicCount_h
00002 #define _posix_AtomicCount_h
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #include <boost/detail/atomic_count.hpp>
00023 #include "ScopedIncrement.h"
00024
00025 namespace qpid {
00026 namespace sys {
00027
00031 class AtomicCount {
00032 public:
00033 typedef ::qpid::sys::ScopedDecrement<AtomicCount> ScopedDecrement;
00034 typedef ::qpid::sys::ScopedIncrement<AtomicCount> ScopedIncrement;
00035
00036 AtomicCount(long value = 0) : count(value) {}
00037
00038 void operator++() { ++count ; }
00039
00040 long operator--() { return --count; }
00041
00042 operator long() const { return count; }
00043
00044
00045 private:
00046 boost::detail::atomic_count count;
00047 };
00048
00049
00050 }}
00051
00052
00053 #endif // _posix_AtomicCount_h