interlocked.hpp

Go to the documentation of this file.
00001 #ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
00002 #define BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
00003 
00004 // MS compatible compilers support #pragma once
00005 
00006 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
00007 # pragma once
00008 #endif
00009 
00010 //
00011 //  boost/detail/interlocked.hpp
00012 //
00013 //  Copyright 2005 Peter Dimov
00014 //
00015 //  Distributed under the Boost Software License, Version 1.0. (See
00016 //  accompanying file LICENSE_1_0.txt or copy at
00017 //  http://www.boost.org/LICENSE_1_0.txt)
00018 //
00019 
00020 #include <sysc/packages/boost/config.hpp>
00021 
00022 #if defined( BOOST_USE_WINDOWS_H )
00023 
00024 # include <windows.h>
00025 
00026 # define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement
00027 # define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement
00028 # define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
00029 
00030 #elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
00031 
00032 extern "C" long __cdecl _InterlockedIncrement( long volatile * );
00033 extern "C" long __cdecl _InterlockedDecrement( long volatile * );
00034 extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
00035 
00036 # pragma intrinsic( _InterlockedIncrement )
00037 # pragma intrinsic( _InterlockedDecrement )
00038 # pragma intrinsic( _InterlockedCompareExchange )
00039 
00040 # define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
00041 # define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
00042 # define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
00043 
00044 #elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
00045 
00046 namespace boost
00047 {
00048 
00049 namespace detail
00050 {
00051 
00052 extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * );
00053 extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * );
00054 extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long );
00055 
00056 } // namespace detail
00057 
00058 } // namespace boost
00059 
00060 # define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement
00061 # define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement
00062 # define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
00063 
00064 #else
00065 
00066 # error "Interlocked intrinsics not available"
00067 
00068 #endif
00069 
00070 #endif // #ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED

Generated on Wed Jan 21 15:32:09 2009 for SystemC by  doxygen 1.5.5