Update to new dtl namespace in boost::container.

This commit is contained in:
Ion Gaztañaga
2017-11-07 00:52:46 +01:00
parent 799356d975
commit b3f9a58079
25 changed files with 101 additions and 58 deletions

View File

@@ -102,7 +102,7 @@ class adaptive_pool_base
typedef typename segment_manager::difference_type difference_type;
typedef boost::interprocess::version_type<adaptive_pool_base, Version> version;
typedef boost::container::container_detail::transform_multiallocation_chain
typedef boost::container::dtl::transform_multiallocation_chain
<typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
//!Obtains adaptive_pool_base from

View File

@@ -109,7 +109,7 @@ class allocator
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//Experimental. Don't use.
typedef boost::container::container_detail::transform_multiallocation_chain
typedef boost::container::dtl::transform_multiallocation_chain
<typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
#endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED

View File

@@ -48,13 +48,13 @@ template< class SegmentManager
, unsigned char OverheadPercent
>
class private_adaptive_node_pool
: public boost::container::container_detail::private_adaptive_node_pool_impl
: public boost::container::dtl::private_adaptive_node_pool_impl
< typename SegmentManager::segment_manager_base_type
, ::boost::container::adaptive_pool_flag::size_ordered |
::boost::container::adaptive_pool_flag::address_ordered
>
{
typedef boost::container::container_detail::private_adaptive_node_pool_impl
typedef boost::container::dtl::private_adaptive_node_pool_impl
< typename SegmentManager::segment_manager_base_type
, ::boost::container::adaptive_pool_flag::size_ordered |
::boost::container::adaptive_pool_flag::address_ordered

View File

@@ -328,7 +328,7 @@ class array_allocation_impl
<const value_type>::type const_reference;
typedef typename SegmentManager::size_type size_type;
typedef typename SegmentManager::difference_type difference_type;
typedef boost::container::container_detail::transform_multiallocation_chain
typedef boost::container::dtl::transform_multiallocation_chain
<typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
@@ -442,7 +442,7 @@ class node_pool_allocation_impl
<const value_type>::type const_reference;
typedef typename SegmentManager::size_type size_type;
typedef typename SegmentManager::difference_type difference_type;
typedef boost::container::container_detail::transform_multiallocation_chain
typedef boost::container::dtl::transform_multiallocation_chain
<typename SegmentManager::multiallocation_chain, T>multiallocation_chain;

View File

@@ -45,10 +45,10 @@ namespace ipcdetail {
template< class SegmentManager, std::size_t NodeSize, std::size_t NodesPerBlock >
class private_node_pool
//Inherit from the implementation to avoid template bloat
: public boost::container::container_detail::
: public boost::container::dtl::
private_node_pool_impl<typename SegmentManager::segment_manager_base_type>
{
typedef boost::container::container_detail::private_node_pool_impl
typedef boost::container::dtl::private_node_pool_impl
<typename SegmentManager::segment_manager_base_type> base_t;
//Non-copyable
private_node_pool();

View File

@@ -99,7 +99,7 @@ class node_allocator_base
typedef typename segment_manager::difference_type difference_type;
typedef boost::interprocess::version_type<node_allocator_base, Version> version;
typedef boost::container::container_detail::transform_multiallocation_chain
typedef boost::container::dtl::transform_multiallocation_chain
<typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
//!Obtains node_allocator_base from

View File

@@ -100,7 +100,7 @@ class private_adaptive_pool_base
typedef typename segment_manager::size_type difference_type;
typedef boost::interprocess::version_type
<private_adaptive_pool_base, Version> version;
typedef boost::container::container_detail::transform_multiallocation_chain
typedef boost::container::dtl::transform_multiallocation_chain
<typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
//!Obtains node_allocator from other node_allocator

View File

@@ -95,7 +95,7 @@ class private_node_allocator_base
typedef typename segment_manager::difference_type difference_type;
typedef boost::interprocess::version_type
<private_node_allocator_base, Version> version;
typedef boost::container::container_detail::transform_multiallocation_chain
typedef boost::container::dtl::transform_multiallocation_chain
<typename SegmentManager::multiallocation_chain, T>multiallocation_chain;
//!Obtains node_allocator from other node_allocator

View File

@@ -26,7 +26,7 @@
namespace boost {
namespace interprocess {
using boost::container::container_detail::pair;
using boost::container::dtl::pair;
} //namespace interprocess {
} //namespace boost {

View File

@@ -25,8 +25,8 @@
namespace boost {
namespace interprocess {
using boost::container::container_detail::version_type;
using boost::container::container_detail::version;
using boost::container::dtl::version_type;
using boost::container::dtl::version;
} //namespace interprocess {
} //namespace boost {

View File

@@ -51,7 +51,7 @@ template<class T>
struct placement_destroy : public in_place_interface
{
placement_destroy()
: in_place_interface(::boost::container::container_detail::alignment_of<T>::value, sizeof(T), typeid(T).name())
: in_place_interface(::boost::container::dtl::alignment_of<T>::value, sizeof(T), typeid(T).name())
{}
virtual void destroy_n(void *mem, std::size_t num, std::size_t &destroyed)

View File

@@ -290,7 +290,7 @@ class intermodule_singleton_common
static union mem_holder_t
{
unsigned char map_mem [sizeof(ThreadSafeGlobalMap)];
::boost::container::container_detail::max_align_t aligner;
::boost::container::dtl::max_align_t aligner;
} mem_holder;
};

View File

@@ -115,8 +115,8 @@ class managed_open_or_create_impl
ct_rounded_size
< sizeof(boost::uint32_t)
, MemAlignment ? (MemAlignment) :
(::boost::container::container_detail::alignment_of
< ::boost::container::container_detail::max_align_t >::value)
(::boost::container::dtl::alignment_of
< ::boost::container::dtl::max_align_t >::value)
>::value;
managed_open_or_create_impl()

View File

@@ -117,7 +117,7 @@ struct block_header
{
return get_rounded_size
( size_type(sizeof(Header))
, size_type(::boost::container::container_detail::alignment_of<block_header<size_type> >::value))
, size_type(::boost::container::dtl::alignment_of<block_header<size_type> >::value))
+ total_size();
}
@@ -169,7 +169,7 @@ struct block_header
template<class T>
static block_header<size_type> *block_header_from_value(T *value)
{ return block_header_from_value(value, sizeof(T), ::boost::container::container_detail::alignment_of<T>::value); }
{ return block_header_from_value(value, sizeof(T), ::boost::container::dtl::alignment_of<T>::value); }
static block_header<size_type> *block_header_from_value(const void *value, std::size_t sz, std::size_t algn)
{
@@ -190,7 +190,7 @@ struct block_header
block_header<size_type> * hdr =
reinterpret_cast<block_header<size_type>*>(reinterpret_cast<char*>(header) +
get_rounded_size( size_type(sizeof(Header))
, size_type(::boost::container::container_detail::alignment_of<block_header<size_type> >::value)));
, size_type(::boost::container::dtl::alignment_of<block_header<size_type> >::value)));
//Some sanity checks
return hdr;
}
@@ -201,7 +201,7 @@ struct block_header
Header * hdr =
reinterpret_cast<Header*>(reinterpret_cast<char*>(bheader) -
get_rounded_size( size_type(sizeof(Header))
, size_type(::boost::container::container_detail::alignment_of<block_header<size_type> >::value)));
, size_type(::boost::container::dtl::alignment_of<block_header<size_type> >::value)));
//Some sanity checks
return hdr;
}
@@ -275,7 +275,7 @@ struct intrusive_value_type_impl
intrusive_value_type_impl(){}
enum { BlockHdrAlignment = ::boost::container::container_detail::alignment_of<block_header<size_type> >::value };
enum { BlockHdrAlignment = ::boost::container::dtl::alignment_of<block_header<size_type> >::value };
block_header<size_type> *get_block_header() const
{

View File

@@ -25,10 +25,10 @@ namespace boost {
namespace interprocess {
namespace ipcdetail {
using boost::container::container_detail::tuple;
using boost::container::container_detail::build_number_seq;
using boost::container::container_detail::index_tuple;
using boost::container::container_detail::get;
using boost::container::dtl::tuple;
using boost::container::dtl::build_number_seq;
using boost::container::dtl::index_tuple;
using boost::container::dtl::get;
}}} //namespace boost { namespace interprocess { namespace ipcdetail {

View File

@@ -74,7 +74,7 @@ class message_queue_t
pointer_traits<void_pointer>::template
rebind_pointer<char>::type char_ptr;
typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
typedef typename boost::container::container_detail::make_unsigned<difference_type>::type size_type;
typedef typename boost::container::dtl::make_unsigned<difference_type>::type size_type;
//!Creates a process shared message queue with name "name". For this message queue,
//!the maximum number of messages will be "max_num_msg" and the maximum message size
@@ -211,7 +211,7 @@ class msg_hdr_t
pointer_traits<void_pointer>::template
rebind_pointer<char>::type char_ptr;
typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
typedef typename boost::container::container_detail::make_unsigned<difference_type>::type size_type;
typedef typename boost::container::dtl::make_unsigned<difference_type>::type size_type;
public:
size_type len; // Message length
@@ -297,7 +297,7 @@ class mq_hdr_t
typedef typename boost::intrusive::pointer_traits
<msg_hdr_ptr_t>::difference_type difference_type;
typedef typename boost::container::
container_detail::make_unsigned<difference_type>::type size_type;
dtl::make_unsigned<difference_type>::type size_type;
typedef typename boost::intrusive::
pointer_traits<void_pointer>::template
rebind_pointer<msg_hdr_ptr_t>::type msg_hdr_ptr_ptr_t;
@@ -529,8 +529,8 @@ class mq_hdr_t
(size_type max_msg_size, size_type max_num_msg)
{
const size_type
msg_hdr_align = ::boost::container::container_detail::alignment_of<msg_header>::value,
index_align = ::boost::container::container_detail::alignment_of<msg_hdr_ptr_t>::value,
msg_hdr_align = ::boost::container::dtl::alignment_of<msg_header>::value,
index_align = ::boost::container::dtl::alignment_of<msg_hdr_ptr_t>::value,
r_hdr_size = ipcdetail::ct_rounded_size<sizeof(mq_hdr_t), index_align>::value,
r_index_size = ipcdetail::get_rounded_size<size_type>(max_num_msg*sizeof(msg_hdr_ptr_t), msg_hdr_align),
r_max_msg_size = ipcdetail::get_rounded_size<size_type>(max_msg_size, msg_hdr_align) + sizeof(msg_header);
@@ -543,8 +543,8 @@ class mq_hdr_t
void initialize_memory()
{
const size_type
msg_hdr_align = ::boost::container::container_detail::alignment_of<msg_header>::value,
index_align = ::boost::container::container_detail::alignment_of<msg_hdr_ptr_t>::value,
msg_hdr_align = ::boost::container::dtl::alignment_of<msg_header>::value,
index_align = ::boost::container::dtl::alignment_of<msg_hdr_ptr_t>::value,
r_hdr_size = ipcdetail::ct_rounded_size<sizeof(mq_hdr_t), index_align>::value,
r_index_size = ipcdetail::get_rounded_size<size_type>(m_max_num_msg*sizeof(msg_hdr_ptr_t), msg_hdr_align),
r_max_msg_size = ipcdetail::get_rounded_size<size_type>(m_max_msg_size, msg_hdr_align) + sizeof(msg_header);
@@ -603,7 +603,7 @@ class msg_queue_initialization_func_t
rebind_pointer<char>::type char_ptr;
typedef typename boost::intrusive::pointer_traits<char_ptr>::
difference_type difference_type;
typedef typename boost::container::container_detail::
typedef typename boost::container::dtl::
make_unsigned<difference_type>::type size_type;
msg_queue_initialization_func_t(size_type maxmsg = 0,

View File

@@ -48,11 +48,11 @@ namespace ipcdetail {
template<class VoidPointer>
class basic_multiallocation_chain
: public boost::container::container_detail::
: public boost::container::dtl::
basic_multiallocation_chain<VoidPointer>
{
BOOST_MOVABLE_BUT_NOT_COPYABLE(basic_multiallocation_chain)
typedef boost::container::container_detail::
typedef boost::container::dtl::
basic_multiallocation_chain<VoidPointer> base_t;
public:

View File

@@ -72,11 +72,11 @@ class simple_seq_fit_impl
typedef MutexFamily mutex_family;
//!Pointer type to be used with the rest of the Interprocess framework
typedef VoidPointer void_pointer;
typedef boost::container::container_detail::
typedef boost::container::dtl::
basic_multiallocation_chain<VoidPointer> multiallocation_chain;
typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
typedef typename boost::container::container_detail::make_unsigned<difference_type>::type size_type;
typedef typename boost::container::dtl::make_unsigned<difference_type>::type size_type;
private:
@@ -270,8 +270,8 @@ class simple_seq_fit_impl
void priv_mark_new_allocated_block(block_ctrl *block);
public:
static const size_type Alignment = ::boost::container::container_detail::alignment_of
< ::boost::container::container_detail::max_align_t>::value;
static const size_type Alignment = ::boost::container::dtl::alignment_of
< ::boost::container::dtl::max_align_t>::value;
private:
static const size_type BlockCtrlBytes = ipcdetail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value;
static const size_type BlockCtrlUnits = BlockCtrlBytes/Alignment;
@@ -590,7 +590,7 @@ inline T* simple_seq_fit_impl<MutexFamily, VoidPointer>::
void *raw_reuse = reuse_ptr;
void * const ret = priv_allocation_command
(command, limit_size, prefer_in_recvd_out_size, raw_reuse, sizeof(T));
BOOST_ASSERT(0 == ((std::size_t)ret % ::boost::container::container_detail::alignment_of<T>::value));
BOOST_ASSERT(0 == ((std::size_t)ret % ::boost::container::dtl::alignment_of<T>::value));
reuse_ptr = static_cast<T*>(raw_reuse);
return static_cast<T*>(ret);
}

View File

@@ -94,7 +94,7 @@ class rbtree_best_fit
typedef ipcdetail::basic_multiallocation_chain<VoidPointer> multiallocation_chain;
typedef typename boost::intrusive::pointer_traits<char_ptr>::difference_type difference_type;
typedef typename boost::container::container_detail::make_unsigned<difference_type>::type size_type;
typedef typename boost::container::dtl::make_unsigned<difference_type>::type size_type;
#if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
@@ -331,8 +331,8 @@ class rbtree_best_fit
public:
static const size_type Alignment = !MemAlignment
? size_type(::boost::container::container_detail::alignment_of
< ::boost::container::container_detail::max_align_t>::value)
? size_type(::boost::container::dtl::alignment_of
< ::boost::container::dtl::max_align_t>::value)
: size_type(MemAlignment)
;
@@ -340,7 +340,7 @@ class rbtree_best_fit
//Due to embedded bits in size, Alignment must be at least 4
BOOST_STATIC_ASSERT((Alignment >= 4));
//Due to rbtree size optimizations, Alignment must have at least pointer alignment
BOOST_STATIC_ASSERT((Alignment >= ::boost::container::container_detail::alignment_of<void_pointer>::value));
BOOST_STATIC_ASSERT((Alignment >= ::boost::container::dtl::alignment_of<void_pointer>::value));
static const size_type AlignmentMask = (Alignment - 1);
static const size_type BlockCtrlBytes = ipcdetail::ct_rounded_size<sizeof(block_ctrl), Alignment>::value;
static const size_type BlockCtrlUnits = BlockCtrlBytes/Alignment;
@@ -692,7 +692,7 @@ inline T* rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
void* raw_reuse = reuse;
void* const ret = priv_allocation_command(command, limit_size, prefer_in_recvd_out_size, raw_reuse, sizeof(T));
reuse = static_cast<T*>(raw_reuse);
BOOST_ASSERT(0 == ((std::size_t)ret % ::boost::container::container_detail::alignment_of<T>::value));
BOOST_ASSERT(0 == ((std::size_t)ret % ::boost::container::dtl::alignment_of<T>::value));
return static_cast<T*>(ret);
}

View File

@@ -66,7 +66,7 @@ namespace ipcdetail {
OffsetType m_offset; //Distance between this object and pointee address
typename ::boost::container::container_detail::aligned_storage
typename ::boost::container::dtl::aligned_storage
< sizeof(OffsetType)//for offset_type_alignment m_offset will be enough
, (OffsetAlignment == offset_type_alignment) ? 1u : OffsetAlignment
>::type alignment_helper;

View File

@@ -72,6 +72,49 @@ void try_based_lock(MutexType &m)
}
}
template<class MutexType>
void timed_based_lock(MutexType &m, unsigned const uCheckPeriodSec)
{
const boost::posix_time::time_duration dur(0, 0, uCheckPeriodSec);
boost::posix_time::ptime deadline(microsec_clock::universal_time()+dur);
if(!m.timed_lock(deadline)){
spin_wait swait;
do{
deadline = microsec_clock::universal_time()+dur;
if(m.timed_lock(deadline)){
break;
}
else{
swait.yield();
}
}
while(1);
}
}
template<class MutexType>
void timed_based_timed_lock(MutexType &m, const boost::posix_time::ptime &abs_time, unsigned const uCheckPeriodSec)
{
const boost::posix_time::time_duration dur(0, 0, uCheckPeriodSec);
boost::posix_time::ptime deadline(microsec_clock::universal_time()+dur);
if(abs_time <= deadline){
m.timed_lock(abs_time);
}
else if(!m.timed_lock(deadline)){
spin_wait swait;
do{
deadline = microsec_clock::universal_time()+dur;
if(m.timed_lock(deadline)){
break;
}
else{
swait.yield();
}
}
while(1);
}
}
} //namespace ipcdetail
} //namespace interprocess
} //namespace boost

View File

@@ -22,17 +22,17 @@ namespace test{
template< class T1, class T2>
bool CheckEqual( const T1 &t1, const T2 &t2
, typename boost::container::container_detail::enable_if_c
<!boost::container::container_detail::is_pair<T1>::value &&
!boost::container::container_detail::is_pair<T2>::value
, typename boost::container::dtl::enable_if_c
<!boost::container::dtl::is_pair<T1>::value &&
!boost::container::dtl::is_pair<T2>::value
>::type* = 0)
{ return t1 == t2; }
template< class Pair1, class Pair2>
bool CheckEqual( const Pair1 &pair1, const Pair2 &pair2
, typename boost::container::container_detail::enable_if_c
<boost::container::container_detail::is_pair<Pair1>::value &&
boost::container::container_detail::is_pair<Pair2>::value
, typename boost::container::dtl::enable_if_c
<boost::container::dtl::is_pair<Pair1>::value &&
boost::container::dtl::is_pair<Pair2>::value
>::type* = 0)
{
return CheckEqual(pair1.first, pair2.first) && CheckEqual(pair1.second, pair2.second);

View File

@@ -142,7 +142,7 @@ bool test_expected_container(const Container &ec, const std::pair<EmplaceInt, Em
static EmplaceInt expected [10];
typedef std::pair<EmplaceInt, EmplaceInt> EmplaceIntPair;
static boost::container::container_detail::aligned_storage<sizeof(EmplaceIntPair)*10>::type pair_storage;
static boost::container::dtl::aligned_storage<sizeof(EmplaceIntPair)*10>::type pair_storage;
static EmplaceIntPair* initialize_emplace_int_pair()
{

View File

@@ -69,7 +69,7 @@ int test_rbtree_best_fit()
int main ()
{
const std::size_t void_ptr_align = ::boost::container::container_detail::alignment_of<offset_ptr<void> >::value;
const std::size_t void_ptr_align = ::boost::container::dtl::alignment_of<offset_ptr<void> >::value;
if(test_simple_seq_fit()){
return 1;

View File

@@ -53,9 +53,9 @@ bool CheckEqual(MyUserList *userlist, MyStdList *stdlist, MyHeapList *heaplist)
int main ()
{
//Create the user memory who will store all objects
const int size_aligner = sizeof(::boost::container::container_detail::max_align_t);
const int size_aligner = sizeof(::boost::container::dtl::max_align_t);
const int memsize = 65536/size_aligner*size_aligner;
static ::boost::container::container_detail::max_align_t static_buffer[memsize/size_aligner];
static ::boost::container::dtl::max_align_t static_buffer[memsize/size_aligner];
{
//Now test move semantics