update boost
This commit is contained in:
@@ -1,32 +0,0 @@
|
||||
// boost lockfree: allocator rebind helper
|
||||
//
|
||||
// Copyright (C) 2017 Minmin Gong
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_LOCKFREE_ALLOCATOR_REBIND_HELPER_HPP_INCLUDED
|
||||
#define BOOST_LOCKFREE_ALLOCATOR_REBIND_HELPER_HPP_INCLUDED
|
||||
|
||||
#include <memory>
|
||||
|
||||
namespace boost {
|
||||
namespace lockfree {
|
||||
namespace detail {
|
||||
|
||||
template <class allocator_type, class value_type>
|
||||
struct allocator_rebind_helper
|
||||
{
|
||||
#if !defined( BOOST_NO_CXX11_ALLOCATOR )
|
||||
typedef typename std::allocator_traits<allocator_type>::template rebind_alloc<value_type> type;
|
||||
#else
|
||||
typedef typename allocator_type::template rebind<value_type>::other type;
|
||||
#endif
|
||||
};
|
||||
|
||||
} /* namespace detail */
|
||||
} /* namespace lockfree */
|
||||
} /* namespace boost */
|
||||
|
||||
#endif /* BOOST_LOCKFREE_ALLOCATOR_REBIND_HELPER_HPP_INCLUDED */
|
||||
@@ -9,6 +9,7 @@
|
||||
#ifndef BOOST_LOCKFREE_FREELIST_HPP_INCLUDED
|
||||
#define BOOST_LOCKFREE_FREELIST_HPP_INCLUDED
|
||||
|
||||
#include <cstring>
|
||||
#include <limits>
|
||||
#include <memory>
|
||||
|
||||
@@ -59,6 +60,7 @@ public:
|
||||
{
|
||||
for (std::size_t i = 0; i != n; ++i) {
|
||||
T * node = Alloc::allocate(1);
|
||||
std::memset((void*)node, 0, sizeof(T));
|
||||
#ifdef BOOST_LOCKFREE_FREELIST_INIT_RUNS_DTOR
|
||||
destruct<false>(node);
|
||||
#else
|
||||
@@ -72,6 +74,7 @@ public:
|
||||
{
|
||||
for (std::size_t i = 0; i != count; ++i) {
|
||||
T * node = Alloc::allocate(1);
|
||||
std::memset((void*)node, 0, sizeof(T));
|
||||
deallocate<ThreadSafe>(node);
|
||||
}
|
||||
}
|
||||
@@ -178,8 +181,11 @@ private:
|
||||
|
||||
for(;;) {
|
||||
if (!old_pool.get_ptr()) {
|
||||
if (!Bounded)
|
||||
return Alloc::allocate(1);
|
||||
if (!Bounded) {
|
||||
T *ptr = Alloc::allocate(1);
|
||||
std::memset((void*)ptr, 0, sizeof(T));
|
||||
return ptr;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -200,8 +206,11 @@ private:
|
||||
tagged_node_ptr old_pool = pool_.load(memory_order_relaxed);
|
||||
|
||||
if (!old_pool.get_ptr()) {
|
||||
if (!Bounded)
|
||||
return Alloc::allocate(1);
|
||||
if (!Bounded) {
|
||||
T *ptr = Alloc::allocate(1);
|
||||
std::memset((void*)ptr, 0, sizeof(T));
|
||||
return ptr;
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
@@ -329,7 +338,7 @@ protected:
|
||||
|
||||
template <typename T,
|
||||
std::size_t size>
|
||||
struct compiletime_sized_freelist_storage
|
||||
struct BOOST_ALIGNMENT(BOOST_LOCKFREE_CACHELINE_BYTES) compiletime_sized_freelist_storage
|
||||
{
|
||||
// array-based freelists only support a 16bit address space.
|
||||
BOOST_STATIC_ASSERT(size < 65536);
|
||||
@@ -339,7 +348,9 @@ struct compiletime_sized_freelist_storage
|
||||
// unused ... only for API purposes
|
||||
template <typename Allocator>
|
||||
compiletime_sized_freelist_storage(Allocator const & /* alloc */, std::size_t /* count */)
|
||||
{}
|
||||
{
|
||||
data.fill(0);
|
||||
}
|
||||
|
||||
T * nodes(void) const
|
||||
{
|
||||
@@ -369,6 +380,7 @@ struct runtime_sized_freelist_storage:
|
||||
if (count > 65535)
|
||||
boost::throw_exception(std::runtime_error("boost.lockfree: freelist size is limited to a maximum of 65535 objects"));
|
||||
nodes_ = allocator_type::allocate(count);
|
||||
std::memset((void*)nodes_, 0, sizeof(T) * count);
|
||||
}
|
||||
|
||||
~runtime_sized_freelist_storage(void)
|
||||
|
||||
@@ -9,13 +9,15 @@
|
||||
#ifndef BOOST_LOCKFREE_DETAIL_PARAMETER_HPP
|
||||
#define BOOST_LOCKFREE_DETAIL_PARAMETER_HPP
|
||||
|
||||
#include <boost/align/aligned_allocator.hpp>
|
||||
#include <boost/core/allocator_access.hpp>
|
||||
#include <boost/lockfree/detail/prefix.hpp>
|
||||
#include <boost/lockfree/policies.hpp>
|
||||
#include <boost/parameter/parameters.hpp>
|
||||
#include <boost/parameter/binding.hpp>
|
||||
#include <boost/parameter/parameters.hpp>
|
||||
|
||||
#include <boost/mpl/void.hpp>
|
||||
|
||||
#include <boost/lockfree/detail/allocator_rebind_helper.hpp>
|
||||
|
||||
|
||||
namespace boost {
|
||||
@@ -53,10 +55,10 @@ struct extract_allocator
|
||||
|
||||
typedef typename mpl::if_c<has_allocator,
|
||||
typename has_arg<bound_args, tag::allocator>::type,
|
||||
std::allocator<T>
|
||||
boost::alignment::aligned_allocator<T, BOOST_LOCKFREE_CACHELINE_BYTES>
|
||||
>::type allocator_arg;
|
||||
|
||||
typedef typename detail::allocator_rebind_helper<allocator_arg, T>::type type;
|
||||
typedef typename boost::allocator_rebind<allocator_arg, T>::type type;
|
||||
};
|
||||
|
||||
template <typename bound_args, bool default_ = false>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
|
||||
#include <boost/predef.h>
|
||||
|
||||
#if BOOST_ARCH_X86_64 || defined (__aarch64__)
|
||||
#if BOOST_ARCH_X86_64 || ( (BOOST_ARCH_ARM >= BOOST_VERSION_NUMBER(8,0,0)) && !BOOST_PLAT_ANDROID )
|
||||
#define BOOST_LOCKFREE_PTR_COMPRESSION 1
|
||||
#endif
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ namespace boost {
|
||||
namespace lockfree {
|
||||
namespace detail {
|
||||
|
||||
#if BOOST_ARCH_X86_64 || defined (__aarch64__)
|
||||
#ifdef BOOST_LOCKFREE_PTR_COMPRESSION
|
||||
|
||||
template <class T>
|
||||
class tagged_ptr
|
||||
|
||||
Reference in New Issue
Block a user