annotate DEPENDENCIES/generic/include/boost/smart_ptr/detail/sp_interlocked.hpp @ 125:34e428693f5d vext

Vext -> Repoint
author Chris Cannam
date Thu, 14 Jun 2018 11:15:39 +0100
parents f46d142149f5
children
rev   line source
Chris@102 1 #ifndef BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED
Chris@102 2 #define BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED
Chris@102 3
Chris@102 4 // MS compatible compilers support #pragma once
Chris@102 5
Chris@102 6 #if defined(_MSC_VER) && (_MSC_VER >= 1020)
Chris@102 7 # pragma once
Chris@102 8 #endif
Chris@102 9
Chris@102 10 //
Chris@102 11 // boost/detail/sp_interlocked.hpp
Chris@102 12 //
Chris@102 13 // Copyright 2005, 2014 Peter Dimov
Chris@102 14 //
Chris@102 15 // Distributed under the Boost Software License, Version 1.0.
Chris@102 16 // See accompanying file LICENSE_1_0.txt or copy at
Chris@102 17 // http://www.boost.org/LICENSE_1_0.txt
Chris@102 18 //
Chris@102 19
Chris@102 20 #include <boost/config.hpp>
Chris@102 21
Chris@102 22 // BOOST_SP_HAS_INTRIN_H
Chris@102 23
Chris@102 24 // VC9 has intrin.h, but it collides with <utility>
Chris@102 25 #if defined( BOOST_MSVC ) && BOOST_MSVC >= 1600
Chris@102 26
Chris@102 27 # define BOOST_SP_HAS_INTRIN_H
Chris@102 28
Chris@102 29 // Unlike __MINGW64__, __MINGW64_VERSION_MAJOR is defined by MinGW-w64 for both 32 and 64-bit targets.
Chris@102 30 #elif defined( __MINGW64_VERSION_MAJOR )
Chris@102 31
Chris@102 32 // MinGW-w64 provides intrin.h for both 32 and 64-bit targets.
Chris@102 33 # define BOOST_SP_HAS_INTRIN_H
Chris@102 34
Chris@102 35 // Intel C++ on Windows on VC10+ stdlib
Chris@102 36 #elif defined( BOOST_INTEL_WIN ) && defined( _CPPLIB_VER ) && _CPPLIB_VER >= 520
Chris@102 37
Chris@102 38 # define BOOST_SP_HAS_INTRIN_H
Chris@102 39
Chris@102 40 #endif
Chris@102 41
Chris@102 42 #if defined( BOOST_USE_WINDOWS_H )
Chris@102 43
Chris@102 44 # include <windows.h>
Chris@102 45
Chris@102 46 # define BOOST_SP_INTERLOCKED_INCREMENT InterlockedIncrement
Chris@102 47 # define BOOST_SP_INTERLOCKED_DECREMENT InterlockedDecrement
Chris@102 48 # define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
Chris@102 49 # define BOOST_SP_INTERLOCKED_EXCHANGE InterlockedExchange
Chris@102 50 # define BOOST_SP_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd
Chris@102 51
Chris@102 52 #elif defined( BOOST_USE_INTRIN_H ) || defined( BOOST_SP_HAS_INTRIN_H )
Chris@102 53
Chris@102 54 #include <intrin.h>
Chris@102 55
Chris@102 56 # define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement
Chris@102 57 # define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement
Chris@102 58 # define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
Chris@102 59 # define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange
Chris@102 60 # define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
Chris@102 61
Chris@102 62 #elif defined( _WIN32_WCE )
Chris@102 63
Chris@102 64 #if _WIN32_WCE >= 0x600
Chris@102 65
Chris@102 66 extern "C" long __cdecl _InterlockedIncrement( long volatile * );
Chris@102 67 extern "C" long __cdecl _InterlockedDecrement( long volatile * );
Chris@102 68 extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
Chris@102 69 extern "C" long __cdecl _InterlockedExchange( long volatile *, long );
Chris@102 70 extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long );
Chris@102 71
Chris@102 72 # define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement
Chris@102 73 # define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement
Chris@102 74 # define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
Chris@102 75 # define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange
Chris@102 76 # define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
Chris@102 77
Chris@102 78 #else
Chris@102 79
Chris@102 80 // under Windows CE we still have old-style Interlocked* functions
Chris@102 81
Chris@102 82 extern "C" long __cdecl InterlockedIncrement( long* );
Chris@102 83 extern "C" long __cdecl InterlockedDecrement( long* );
Chris@102 84 extern "C" long __cdecl InterlockedCompareExchange( long*, long, long );
Chris@102 85 extern "C" long __cdecl InterlockedExchange( long*, long );
Chris@102 86 extern "C" long __cdecl InterlockedExchangeAdd( long*, long );
Chris@102 87
Chris@102 88 # define BOOST_SP_INTERLOCKED_INCREMENT InterlockedIncrement
Chris@102 89 # define BOOST_SP_INTERLOCKED_DECREMENT InterlockedDecrement
Chris@102 90 # define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
Chris@102 91 # define BOOST_SP_INTERLOCKED_EXCHANGE InterlockedExchange
Chris@102 92 # define BOOST_SP_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd
Chris@102 93
Chris@102 94 #endif
Chris@102 95
Chris@102 96 #elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
Chris@102 97
Chris@102 98 #if defined( __CLRCALL_PURE_OR_CDECL )
Chris@102 99
Chris@102 100 extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * );
Chris@102 101 extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * );
Chris@102 102 extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedCompareExchange( long volatile *, long, long );
Chris@102 103 extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchange( long volatile *, long );
Chris@102 104 extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchangeAdd( long volatile *, long );
Chris@102 105
Chris@102 106 #else
Chris@102 107
Chris@102 108 extern "C" long __cdecl _InterlockedIncrement( long volatile * );
Chris@102 109 extern "C" long __cdecl _InterlockedDecrement( long volatile * );
Chris@102 110 extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
Chris@102 111 extern "C" long __cdecl _InterlockedExchange( long volatile *, long );
Chris@102 112 extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long );
Chris@102 113
Chris@102 114 #endif
Chris@102 115
Chris@102 116 # define BOOST_SP_INTERLOCKED_INCREMENT _InterlockedIncrement
Chris@102 117 # define BOOST_SP_INTERLOCKED_DECREMENT _InterlockedDecrement
Chris@102 118 # define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
Chris@102 119 # define BOOST_SP_INTERLOCKED_EXCHANGE _InterlockedExchange
Chris@102 120 # define BOOST_SP_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
Chris@102 121
Chris@102 122 #elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
Chris@102 123
Chris@102 124 namespace boost
Chris@102 125 {
Chris@102 126
Chris@102 127 namespace detail
Chris@102 128 {
Chris@102 129
Chris@102 130 extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * );
Chris@102 131 extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * );
Chris@102 132 extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long );
Chris@102 133 extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long );
Chris@102 134 extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long );
Chris@102 135
Chris@102 136 } // namespace detail
Chris@102 137
Chris@102 138 } // namespace boost
Chris@102 139
Chris@102 140 # define BOOST_SP_INTERLOCKED_INCREMENT ::boost::detail::InterlockedIncrement
Chris@102 141 # define BOOST_SP_INTERLOCKED_DECREMENT ::boost::detail::InterlockedDecrement
Chris@102 142 # define BOOST_SP_INTERLOCKED_COMPARE_EXCHANGE ::boost::detail::InterlockedCompareExchange
Chris@102 143 # define BOOST_SP_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange
Chris@102 144 # define BOOST_SP_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd
Chris@102 145
Chris@102 146 #else
Chris@102 147
Chris@102 148 # error "Interlocked intrinsics not available"
Chris@102 149
Chris@102 150 #endif
Chris@102 151
Chris@102 152 #endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_INTERLOCKED_HPP_INCLUDED