summaryrefslogtreecommitdiff
path: root/boost/lockfree/detail
diff options
context:
space:
mode:
Diffstat (limited to 'boost/lockfree/detail')
-rw-r--r--boost/lockfree/detail/atomic.hpp6
-rw-r--r--boost/lockfree/detail/copy_payload.hpp2
-rw-r--r--boost/lockfree/detail/freelist.hpp8
-rw-r--r--boost/lockfree/detail/parameter.hpp7
-rw-r--r--boost/lockfree/detail/prefix.hpp40
-rw-r--r--boost/lockfree/detail/tagged_ptr.hpp2
-rw-r--r--boost/lockfree/detail/tagged_ptr_dcas.hpp11
-rw-r--r--boost/lockfree/detail/tagged_ptr_ptrcompression.hpp6
8 files changed, 30 insertions, 52 deletions
diff --git a/boost/lockfree/detail/atomic.hpp b/boost/lockfree/detail/atomic.hpp
index d15474ada9..6083800f0f 100644
--- a/boost/lockfree/detail/atomic.hpp
+++ b/boost/lockfree/detail/atomic.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2011-2013 Tim Blechmann
+// Copyright (C) 2011-2013, 2016 Tim Blechmann
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -51,7 +51,7 @@
#endif // BOOST_LOCKFREE_FORCE_STD_ATOMIC
-#if defined(BOOST_LOCKFREE_NO_HDR_ATOMIC)
+#if defined(BOOST_LOCKFREE_NO_HDR_ATOMIC) || defined(BOOST_LOCKFREE_FORCE_BOOST_ATOMIC)
#include <boost/atomic.hpp>
#else
#include <atomic>
@@ -61,7 +61,7 @@ namespace boost {
namespace lockfree {
namespace detail {
-#if defined(BOOST_LOCKFREE_NO_HDR_ATOMIC)
+#if defined(BOOST_LOCKFREE_NO_HDR_ATOMIC) || defined(BOOST_LOCKFREE_FORCE_BOOST_ATOMIC)
using boost::atomic;
using boost::memory_order_acquire;
using boost::memory_order_consume;
diff --git a/boost/lockfree/detail/copy_payload.hpp b/boost/lockfree/detail/copy_payload.hpp
index 75b1b52a2b..5972da7c64 100644
--- a/boost/lockfree/detail/copy_payload.hpp
+++ b/boost/lockfree/detail/copy_payload.hpp
@@ -1,6 +1,6 @@
// boost lockfree: copy_payload helper
//
-// Copyright (C) 2011 Tim Blechmann
+// Copyright (C) 2011, 2016 Tim Blechmann
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
diff --git a/boost/lockfree/detail/freelist.hpp b/boost/lockfree/detail/freelist.hpp
index 3a134e29b9..48dbb508f5 100644
--- a/boost/lockfree/detail/freelist.hpp
+++ b/boost/lockfree/detail/freelist.hpp
@@ -49,6 +49,7 @@ class freelist_stack:
typedef tagged_ptr<freelist_node> tagged_node_ptr;
public:
+ typedef T * index_t;
typedef tagged_ptr<T> tagged_node_handle;
template <typename Allocator>
@@ -254,7 +255,9 @@ private:
atomic<tagged_node_ptr> pool_;
};
-class tagged_index
+class
+BOOST_ALIGNMENT( 4 ) // workaround for bugs in MSVC
+tagged_index
{
public:
typedef boost::uint16_t tag_t;
@@ -396,8 +399,6 @@ class fixed_size_freelist:
tagged_index next;
};
- typedef tagged_index::index_t index_t;
-
void initialize(void)
{
T * nodes = NodeStorage::nodes();
@@ -415,6 +416,7 @@ class fixed_size_freelist:
public:
typedef tagged_index tagged_node_handle;
+ typedef tagged_index::index_t index_t;
template <typename Allocator>
fixed_size_freelist (Allocator const & alloc, std::size_t count):
diff --git a/boost/lockfree/detail/parameter.hpp b/boost/lockfree/detail/parameter.hpp
index 2e2b068bed..e5db1206e5 100644
--- a/boost/lockfree/detail/parameter.hpp
+++ b/boost/lockfree/detail/parameter.hpp
@@ -1,6 +1,6 @@
// boost lockfree
//
-// Copyright (C) 2011 Tim Blechmann
+// Copyright (C) 2011, 2016 Tim Blechmann
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -10,6 +10,11 @@
#define BOOST_LOCKFREE_DETAIL_PARAMETER_HPP
#include <boost/lockfree/policies.hpp>
+#include <boost/parameter/parameters.hpp>
+#include <boost/parameter/binding.hpp>
+
+#include <boost/mpl/void.hpp>
+
namespace boost {
namespace lockfree {
diff --git a/boost/lockfree/detail/prefix.hpp b/boost/lockfree/detail/prefix.hpp
index 6ed9446cb0..0c9f29af16 100644
--- a/boost/lockfree/detail/prefix.hpp
+++ b/boost/lockfree/detail/prefix.hpp
@@ -1,4 +1,4 @@
-// Copyright (C) 2009 Tim Blechmann
+// Copyright (C) 2009, 2016 Tim Blechmann
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -11,46 +11,14 @@
BOOST_LOCKFREE_CACHELINE_BYTES: size of a cache line
BOOST_LOCKFREE_PTR_COMPRESSION: use tag/pointer compression to utilize parts
of the virtual address space as tag (at least 16bit)
- BOOST_LOCKFREE_DCAS_ALIGNMENT: symbol used for aligning structs at cache line
- boundaries
*/
#define BOOST_LOCKFREE_CACHELINE_BYTES 64
-#ifdef _MSC_VER
+#include <boost/predef.h>
-#define BOOST_LOCKFREE_CACHELINE_ALIGNMENT __declspec(align(BOOST_LOCKFREE_CACHELINE_BYTES))
-
-#if defined(_M_IX86)
- #define BOOST_LOCKFREE_DCAS_ALIGNMENT
-#elif defined(_M_X64) || defined(_M_IA64)
- #define BOOST_LOCKFREE_PTR_COMPRESSION 1
- #define BOOST_LOCKFREE_DCAS_ALIGNMENT __declspec(align(16))
-#endif
-
-#endif /* _MSC_VER */
-
-#ifdef __GNUC__
-
-#define BOOST_LOCKFREE_CACHELINE_ALIGNMENT __attribute__((aligned(BOOST_LOCKFREE_CACHELINE_BYTES)))
-
-#if defined(__i386__) || defined(__ppc__)
- #define BOOST_LOCKFREE_DCAS_ALIGNMENT
-#elif defined(__x86_64__)
- #define BOOST_LOCKFREE_PTR_COMPRESSION 1
- #define BOOST_LOCKFREE_DCAS_ALIGNMENT __attribute__((aligned(16)))
-#elif defined(__alpha__)
- // LATER: alpha may benefit from pointer compression. but what is the maximum size of the address space?
- #define BOOST_LOCKFREE_DCAS_ALIGNMENT
-#endif
-#endif /* __GNUC__ */
-
-#ifndef BOOST_LOCKFREE_DCAS_ALIGNMENT
-#define BOOST_LOCKFREE_DCAS_ALIGNMENT /*BOOST_LOCKFREE_DCAS_ALIGNMENT*/
-#endif
-
-#ifndef BOOST_LOCKFREE_CACHELINE_ALIGNMENT
-#define BOOST_LOCKFREE_CACHELINE_ALIGNMENT /*BOOST_LOCKFREE_CACHELINE_ALIGNMENT*/
+#ifdef BOOST_ARCH_X86_64
+#define BOOST_LOCKFREE_PTR_COMPRESSION 1
#endif
#endif /* BOOST_LOCKFREE_PREFIX_HPP_INCLUDED */
diff --git a/boost/lockfree/detail/tagged_ptr.hpp b/boost/lockfree/detail/tagged_ptr.hpp
index f70a2c751a..10ab2e9126 100644
--- a/boost/lockfree/detail/tagged_ptr.hpp
+++ b/boost/lockfree/detail/tagged_ptr.hpp
@@ -1,6 +1,6 @@
// tagged pointer, for aba prevention
//
-// Copyright (C) 2008 Tim Blechmann
+// Copyright (C) 2008, 2016 Tim Blechmann
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
diff --git a/boost/lockfree/detail/tagged_ptr_dcas.hpp b/boost/lockfree/detail/tagged_ptr_dcas.hpp
index 6cb5a0616b..83718daea2 100644
--- a/boost/lockfree/detail/tagged_ptr_dcas.hpp
+++ b/boost/lockfree/detail/tagged_ptr_dcas.hpp
@@ -1,6 +1,6 @@
// tagged pointer, for aba prevention
//
-// Copyright (C) 2008 Tim Blechmann
+// Copyright (C) 2008, 2016 Tim Blechmann
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -12,13 +12,16 @@
#include <cstddef> /* for std::size_t */
#include <limits>
+#include <boost/predef.h>
-namespace boost {
+namespace boost {
namespace lockfree {
-namespace detail {
+namespace detail {
+
+
template <class T>
-class BOOST_LOCKFREE_DCAS_ALIGNMENT tagged_ptr
+class BOOST_ALIGNMENT(2 * sizeof(void*)) tagged_ptr
{
public:
typedef std::size_t tag_t;
diff --git a/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp b/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp
index 15d383018c..bcf6e34f6b 100644
--- a/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp
+++ b/boost/lockfree/detail/tagged_ptr_ptrcompression.hpp
@@ -1,6 +1,6 @@
// tagged pointer, for aba prevention
//
-// Copyright (C) 2008, 2009 Tim Blechmann, based on code by Cory Nelson
+// Copyright (C) 2008, 2009, 2016 Tim Blechmann, based on code by Cory Nelson
//
// Distributed under the Boost Software License, Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
@@ -13,13 +13,13 @@
#include <limits>
#include <boost/cstdint.hpp>
-
+#include <boost/predef.h>
namespace boost {
namespace lockfree {
namespace detail {
-#if defined (__x86_64__) || defined (_M_X64)
+#ifdef BOOST_ARCH_X86_64
template <class T>
class tagged_ptr