00001
00002
00003
00004
00005
00006
00007
00008
00009 #ifndef BOOST_LOCKFREE_PREFIX_HPP_INCLUDED
00010 #define BOOST_LOCKFREE_PREFIX_HPP_INCLUDED
00011
00012 #include <cassert>
00013
00014
00015 #ifdef _WIN32
00016 #include <windows.h>
00017 #endif
00018
00019 #ifdef __APPLE__
00020 #include <libkern/OSAtomic.h>
00021
00022 #include <bits/atomicity.h>
00023 #endif
00024
00025 #define BOOST_LOCKFREE_CACHELINE_BYTES 64
00026
00027 #ifdef _MSC_VER
00028
00029 extern "C" {
00030 void __cdecl _ReadWriteBarrier();
00031 LONG __cdecl _InterlockedCompareExchange(LONG volatile* Dest,LONG Exchange, LONG Comp);
00032 }
00033
00034 #define BOOST_LOCKFREE_CACHELINE_ALIGNMENT __declspec(align(BOOST_LOCKFREE_CACHELINE_BYTES))
00035
00036 #if defined(_M_IX86)
00037 #define BOOST_LOCKFREE_DCAS_ALIGNMENT
00038 #elif defined(_M_X64) || defined(_M_IA64)
00039 #define BOOST_LOCKFREE_PTR_COMPRESSION 1
00040 #define BOOST_LOCKFREE_DCAS_ALIGNMENT __declspec(align(16))
00041 #endif
00042
00043 #endif
00044
00045 #ifdef __GNUC__
00046
00047
00048 #define BOOST_LOCKFREE_CACHELINE_ALIGNMENT __attribute__((aligned(64)))
00049
00050 #ifdef __i386__
00051 #define BOOST_LOCKFREE_DCAS_ALIGNMENT
00052 #elif defined(__ppc__)
00053 #define BOOST_LOCKFREE_DCAS_ALIGNMENT
00054 #elif defined(__x86_64__)
00055
00056 #if !(defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16))
00057 #define BOOST_LOCKFREE_PTR_COMPRESSION 1
00058 #endif
00059 #define BOOST_LOCKFREE_DCAS_ALIGNMENT __attribute__((aligned(16)))
00060 #endif
00061
00062 #endif
00063
00064
00065 #ifdef USE_ATOMIC_OPS
00066 #define AO_REQUIRE_CAS
00067 #define AO_USE_PENTIUM4_INSTRS
00068
00069 extern "C" {
00070 #include "../libatomic_ops/src/atomic_ops.h"
00071 }
00072 #endif
00073
00074
00075 #endif