pion-net
4.0.9
Main Page
Namespaces
Classes
Files
File List
common
include
boost
lockfree
detail
prefix.hpp
1
// Copyright (C) 2007, 2008, 2009 Tim Blechmann & Thomas Grill
2
//
3
// Distributed under the Boost Software License, Version 1.0. (See
4
// accompanying file LICENSE_1_0.txt or copy at
5
// http://www.boost.org/LICENSE_1_0.txt)
6
7
// Disclaimer: Not a Boost library.
8
9
#ifndef BOOST_LOCKFREE_PREFIX_HPP_INCLUDED
10
#define BOOST_LOCKFREE_PREFIX_HPP_INCLUDED
11
12
#include <cassert>
13
14
15
#ifdef _WIN32
16
#include <windows.h>
17
#endif
18
19
#ifdef __APPLE__
20
#include <libkern/OSAtomic.h>
21
22
// #include <bits/atomicity.h>
23
#endif
24
25
#define BOOST_LOCKFREE_CACHELINE_BYTES 64
26
27
#ifdef _MSC_VER
28
// \note: Must use /Oi option for VC++ to enable intrinsics
29
extern
"C"
{
30
void
__cdecl _ReadWriteBarrier();
31
LONG __cdecl _InterlockedCompareExchange(LONG
volatile
* Dest,LONG Exchange, LONG Comp);
32
}
33
34
#define BOOST_LOCKFREE_CACHELINE_ALIGNMENT __declspec(align(BOOST_LOCKFREE_CACHELINE_BYTES))
35
36
#if defined(_M_IX86)
37
#define BOOST_LOCKFREE_DCAS_ALIGNMENT
38
#elif defined(_M_X64) || defined(_M_IA64)
39
#define BOOST_LOCKFREE_PTR_COMPRESSION 1
40
#define BOOST_LOCKFREE_DCAS_ALIGNMENT __declspec(align(16))
41
#endif
42
43
#endif
/* _MSC_VER */
44
45
#ifdef __GNUC__
46
47
//#define BOOST_LOCKFREE_CACHELINE_ALIGNMENT __attribute__((aligned(BOOST_LOCKFREE_CACHELINE_ALIGNMENT)))
48
#define BOOST_LOCKFREE_CACHELINE_ALIGNMENT __attribute__((aligned(64)))
49
50
#ifdef __i386__
51
#define BOOST_LOCKFREE_DCAS_ALIGNMENT
52
#elif defined(__ppc__)
53
#define BOOST_LOCKFREE_DCAS_ALIGNMENT
54
#elif defined(__x86_64__)
55
56
#if !(defined (__GCC_HAVE_SYNC_COMPARE_AND_SWAP_16))
57
#define BOOST_LOCKFREE_PTR_COMPRESSION 1
58
#endif
59
#define BOOST_LOCKFREE_DCAS_ALIGNMENT __attribute__((aligned(16)))
60
#endif
61
62
#endif
/* __GNUC__ */
63
64
65
#ifdef USE_ATOMIC_OPS
66
#define AO_REQUIRE_CAS
67
#define AO_USE_PENTIUM4_INSTRS
68
69
extern
"C"
{
70
#include "../libatomic_ops/src/atomic_ops.h"
71
}
72
#endif
73
74
75
#endif
/* BOOST_LOCKFREE_PREFIX_HPP_INCLUDED */
Generated by
1.8.1.2