source: NonGTP/Boost/boost/detail/interlocked.hpp @ 857

Revision 857, 2.1 KB checked in by igarcia, 19 years ago (diff)
Line 
1#ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
2#define BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
3
4// MS compatible compilers support #pragma once
5
6#if defined(_MSC_VER) && (_MSC_VER >= 1020)
7# pragma once
8#endif
9
10//
11//  boost/detail/interlocked.hpp
12//
13//  Copyright 2005 Peter Dimov
14//
15//  Distributed under the Boost Software License, Version 1.0. (See
16//  accompanying file LICENSE_1_0.txt or copy at
17//  http://www.boost.org/LICENSE_1_0.txt)
18//
19
20#include <boost/config.hpp>
21
22#if defined( BOOST_USE_WINDOWS_H )
23
24# include <windows.h>
25
26# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement
27# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement
28# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
29
30#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
31
32extern "C" long __cdecl _InterlockedIncrement( long volatile * );
33extern "C" long __cdecl _InterlockedDecrement( long volatile * );
34extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
35
36# pragma intrinsic( _InterlockedIncrement )
37# pragma intrinsic( _InterlockedDecrement )
38# pragma intrinsic( _InterlockedCompareExchange )
39
40# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
41# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
42# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
43
44#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
45
46namespace boost
47{
48
49namespace detail
50{
51
52extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * );
53extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * );
54extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long );
55
56} // namespace detail
57
58} // namespace boost
59
60# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement
61# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement
62# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
63
64#else
65
66# error "Interlocked intrinsics not available"
67
68#endif
69
70#endif // #ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
Note: See TracBrowser for help on using the repository browser.