src/sysc/packages/boost/detail/atomic_count_win32.hpp

Go to the documentation of this file.
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 //  boost/detail/atomic_count_win32.hpp
00010 //
00011 //  Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
00012 //
00013 //  Permission to copy, use, modify, sell and distribute this software
00014 //  is granted provided this copyright notice appears in all copies.
00015 //  This software is provided "as is" without express or implied
00016 //  warranty, and with no claim as to its suitability for any purpose.
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 } // namespace detail
00059 
00060 } // namespace boost
00061 
00062 #endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED

Generated on Wed Apr 25 13:53:28 2007 for SystemC by  doxygen 1.5.1