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

Go to the documentation of this file.
00001 #ifndef BOOST_DETAIL_WINAPI_HPP_INCLUDED
00002 #define BOOST_DETAIL_WINAPI_HPP_INCLUDED
00003 
00004 #if _MSC_VER >= 1020
00005 #pragma once
00006 #endif
00007 
00008 //
00009 //  boost/detail/winapi.hpp - a lightweight version of <windows.h>
00010 //
00011 //  Copyright (c) 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 namespace boost
00020 {
00021 
00022 namespace detail
00023 {
00024 
00025 namespace winapi
00026 {
00027 
00028 typedef long long_type;
00029 typedef unsigned long dword_type;
00030 typedef void * handle_type;
00031 
00032 #if defined(_WIN64)
00033 
00034 typedef __int64 int_ptr_type;
00035 typedef unsigned __int64 uint_ptr_type;
00036 typedef __int64 long_ptr_type;
00037 typedef unsigned __int64 ulong_ptr_type;
00038 
00039 #else
00040 
00041 typedef int int_ptr_type;
00042 typedef unsigned int uint_ptr_type;
00043 typedef long long_ptr_type;
00044 typedef unsigned long ulong_ptr_type;
00045 
00046 #endif
00047 
00048 struct critical_section
00049 {
00050     struct critical_section_debug * DebugInfo;
00051     long_type LockCount;
00052     long_type RecursionCount;
00053     handle_type OwningThread;
00054     handle_type LockSemaphore;
00055     ulong_ptr_type SpinCount;
00056 };
00057 
00058 #if defined(_WIN64)
00059 
00060 // Intel 6.0 on Win64 version, posted by Tim Fenders to [boost-users]
00061 
00062 extern "C" long_type __cdecl _InterlockedIncrement(long_type volatile *);
00063 extern "C" long_type __cdecl _InterlockedDecrement(long_type volatile *);
00064 extern "C" long_type __cdecl _InterlockedExchange(long_type volatile *, long_type);
00065 
00066 #pragma intrinsic(_InterlockedIncrement)
00067 #pragma intrinsic(_InterlockedDecrement)
00068 #pragma intrinsic(_InterlockedExchange)
00069 
00070 inline long_type InterlockedIncrement(long_type volatile * lp)
00071 { 
00072     return _InterlockedIncrement(lp);
00073 }
00074 
00075 inline long_type InterlockedDecrement(long_type volatile* lp)
00076 { 
00077     return _InterlockedDecrement(lp);
00078 }
00079 
00080 inline long_type InterlockedExchange(long_type volatile* lp, long_type l)
00081 {
00082     return _InterlockedExchange(lp, l);
00083 }
00084 
00085 #else
00086 
00087 extern "C" __declspec(dllimport) long_type __stdcall InterlockedIncrement(long_type volatile *);
00088 extern "C" __declspec(dllimport) long_type __stdcall InterlockedDecrement(long_type volatile *);
00089 extern "C" __declspec(dllimport) long_type __stdcall InterlockedExchange(long_type volatile *, long_type);
00090 
00091 #endif
00092 
00093 extern "C" __declspec(dllimport) void __stdcall Sleep(dword_type);
00094 
00095 extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(critical_section *);
00096 extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(critical_section *);
00097 extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(critical_section *);
00098 extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(critical_section *);
00099 
00100 } // namespace winapi
00101 
00102 } // namespace detail
00103 
00104 } // namespace boost
00105 
00106 #endif // #ifndef BOOST_DETAIL_WINAPI_HPP_INCLUDED

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