summaryrefslogtreecommitdiff
path: root/boost/interprocess/segment_manager.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'boost/interprocess/segment_manager.hpp')
-rw-r--r--boost/interprocess/segment_manager.hpp304
1 files changed, 140 insertions, 164 deletions
diff --git a/boost/interprocess/segment_manager.hpp b/boost/interprocess/segment_manager.hpp
index 8680a953e2..87c0041cf4 100644
--- a/boost/interprocess/segment_manager.hpp
+++ b/boost/interprocess/segment_manager.hpp
@@ -1,6 +1,6 @@
//////////////////////////////////////////////////////////////////////////////
//
-// (C) Copyright Ion Gaztanaga 2005-2011. Distributed under the Boost
+// (C) Copyright Ion Gaztanaga 2005-2012. 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)
//
@@ -11,7 +11,7 @@
#ifndef BOOST_INTERPROCESS_SEGMENT_MANAGER_HPP
#define BOOST_INTERPROCESS_SEGMENT_MANAGER_HPP
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#if defined(_MSC_VER)
# pragma once
#endif
@@ -32,7 +32,7 @@
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/smart_ptr/deleter.hpp>
-#include <boost/move/move.hpp>
+#include <boost/move/utility_core.hpp>
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <cstddef> //std::size_t
#include <string> //char_traits
@@ -69,15 +69,15 @@ class segment_manager_base
typedef typename MemoryAlgorithm::void_pointer void_pointer;
typedef typename MemoryAlgorithm::mutex_family mutex_family;
typedef MemoryAlgorithm memory_algorithm;
-
- /// @cond
-
+
+ #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
+
//Experimental. Don't use
typedef typename MemoryAlgorithm::multiallocation_chain multiallocation_chain;
typedef typename MemoryAlgorithm::difference_type difference_type;
typedef typename MemoryAlgorithm::size_type size_type;
- /// @endcond
+ #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
//!This constant indicates the payload size
//!associated with each allocation of the memory algorithm
@@ -94,8 +94,8 @@ class segment_manager_base
//!dynamic allocation
//!
//!Can throw
- segment_manager_base(size_type size, size_type reserved_bytes)
- : MemoryAlgorithm(size, reserved_bytes)
+ segment_manager_base(size_type sz, size_type reserved_bytes)
+ : MemoryAlgorithm(sz, reserved_bytes)
{
BOOST_ASSERT((sizeof(segment_manager_base<MemoryAlgorithm>) == sizeof(MemoryAlgorithm)));
}
@@ -120,52 +120,53 @@ class segment_manager_base
void * allocate (size_type nbytes, std::nothrow_t)
{ return MemoryAlgorithm::allocate(nbytes); }
- /// @cond
+ #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//Experimental. Dont' use.
- //!Allocates n_elements of
- //!elem_size bytes. Throws bad_alloc on failure.
- multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements)
+ //!Allocates n_elements of elem_bytes bytes.
+ //!Throws bad_alloc on failure. chain.size() is not increased on failure.
+ void allocate_many(size_type elem_bytes, size_type n_elements, multiallocation_chain &chain)
{
- multiallocation_chain mem(MemoryAlgorithm::allocate_many(elem_bytes, num_elements));
- if(mem.empty()) throw bad_alloc();
- return boost::move(mem);
+ size_type prev_size = chain.size();
+ MemoryAlgorithm::allocate_many(elem_bytes, n_elements, chain);
+ if(!elem_bytes || chain.size() == prev_size){
+ throw bad_alloc();
+ }
}
- //!Allocates n_elements, each one of
- //!element_lenghts[i]*sizeof_element bytes. Throws bad_alloc on failure.
- multiallocation_chain allocate_many
- (const size_type *element_lenghts, size_type n_elements, size_type sizeof_element = 1)
+ //!Allocates n_elements, each one of element_lengths[i]*sizeof_element bytes.
+ //!Throws bad_alloc on failure. chain.size() is not increased on failure.
+ void allocate_many(const size_type *element_lengths, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain)
{
- multiallocation_chain mem(MemoryAlgorithm::allocate_many(element_lenghts, n_elements, sizeof_element));
- if(mem.empty()) throw bad_alloc();
- return boost::move(mem);
+ size_type prev_size = chain.size();
+ MemoryAlgorithm::allocate_many(element_lengths, n_elements, sizeof_element, chain);
+ if(!sizeof_element || chain.size() == prev_size){
+ throw bad_alloc();
+ }
}
- //!Allocates n_elements of
- //!elem_size bytes. Returns a default constructed iterator on failure.
- multiallocation_chain allocate_many
- (size_type elem_bytes, size_type num_elements, std::nothrow_t)
- { return MemoryAlgorithm::allocate_many(elem_bytes, num_elements); }
+ //!Allocates n_elements of elem_bytes bytes.
+ //!Non-throwing version. chain.size() is not increased on failure.
+ void allocate_many(std::nothrow_t, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain)
+ { MemoryAlgorithm::allocate_many(elem_bytes, n_elements, chain); }
//!Allocates n_elements, each one of
- //!element_lenghts[i]*sizeof_element bytes.
- //!Returns a default constructed iterator on failure.
- multiallocation_chain allocate_many
- (const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, std::nothrow_t)
- { return MemoryAlgorithm::allocate_many(elem_sizes, n_elements, sizeof_element); }
+ //!element_lengths[i]*sizeof_element bytes.
+ //!Non-throwing version. chain.size() is not increased on failure.
+ void allocate_many(std::nothrow_t, const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain)
+ { MemoryAlgorithm::allocate_many(elem_sizes, n_elements, sizeof_element, chain); }
- //!Deallocates elements pointed by the
- //!multiallocation iterator range.
- void deallocate_many(multiallocation_chain chain)
- { MemoryAlgorithm::deallocate_many(boost::move(chain)); }
+ //!Deallocates all elements contained in chain.
+ //!Never throws.
+ void deallocate_many(multiallocation_chain &chain)
+ { MemoryAlgorithm::deallocate_many(chain); }
- /// @endcond
+ #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
//!Allocates nbytes bytes. Throws boost::interprocess::bad_alloc
//!on failure
void * allocate(size_type nbytes)
- {
+ {
void * ret = MemoryAlgorithm::allocate(nbytes);
if(!ret)
throw bad_alloc();
@@ -180,13 +181,15 @@ class segment_manager_base
//!Allocates nbytes bytes. This function is only used in
//!single-segment management. Throws bad_alloc when fails
void * allocate_aligned(size_type nbytes, size_type alignment)
- {
+ {
void * ret = MemoryAlgorithm::allocate_aligned(nbytes, alignment);
if(!ret)
throw bad_alloc();
return ret;
}
+ #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
+
template<class T>
std::pair<T *, bool>
allocation_command (boost::interprocess::allocation_type command, size_type limit_size,
@@ -214,6 +217,8 @@ class segment_manager_base
return ret;
}
+ #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
+
//!Deallocates the bytes allocated with allocate/allocate_many()
//!pointed by addr
void deallocate (void *addr)
@@ -248,7 +253,7 @@ class segment_manager_base
size_type size(const void *ptr) const
{ return MemoryAlgorithm::size(ptr); }
- /// @cond
+ #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
protected:
void * prot_anonymous_construct
(size_type num, bool dothrow, ipcdetail::in_place_interface &table)
@@ -293,7 +298,7 @@ class segment_manager_base
void prot_anonymous_destroy(const void *object, ipcdetail::in_place_interface &table)
{
- //Get control data from associated with this object
+ //Get control data from associated with this object
typedef ipcdetail::block_header<size_type> block_header_t;
block_header_t *ctrl_data = block_header_t::block_header_from_value(object, table.size, table.alignment);
@@ -312,7 +317,7 @@ class segment_manager_base
table.destroy_n(const_cast<void*>(object), ctrl_data->m_value_bytes/table.size, destroyed);
this->deallocate(ctrl_data);
}
- /// @endcond
+ #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
};
//!This object is placed in the beginning of memory segment and
@@ -337,26 +342,26 @@ template<class CharType
class segment_manager
: public segment_manager_base<MemoryAlgorithm>
{
- /// @cond
+ #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//Non-copyable
segment_manager();
segment_manager(const segment_manager &);
segment_manager &operator=(const segment_manager &);
- typedef segment_manager_base<MemoryAlgorithm> Base;
- /// @endcond
+ typedef segment_manager_base<MemoryAlgorithm> segment_manager_base_t;
+ #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
public:
- typedef MemoryAlgorithm memory_algorithm;
- typedef typename Base::void_pointer void_pointer;
- typedef typename Base::size_type size_type;
- typedef typename Base::difference_type difference_type;
- typedef CharType char_type;
+ typedef MemoryAlgorithm memory_algorithm;
+ typedef typename segment_manager_base_t::void_pointer void_pointer;
+ typedef typename segment_manager_base_t::size_type size_type;
+ typedef typename segment_manager_base_t::difference_type difference_type;
+ typedef CharType char_type;
typedef segment_manager_base<MemoryAlgorithm> segment_manager_base_type;
- static const size_type PayloadPerAllocation = Base::PayloadPerAllocation;
+ static const size_type PayloadPerAllocation = segment_manager_base_t::PayloadPerAllocation;
- /// @cond
+ #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
private:
typedef ipcdetail::block_header<size_type> block_header_t;
typedef ipcdetail::index_config<CharType, MemoryAlgorithm> index_config_named;
@@ -376,16 +381,16 @@ class segment_manager
typedef ipcdetail::segment_manager_iterator_transform
<typename unique_index_t::const_iterator
,is_intrusive_index<index_type>::value> unique_transform;
- /// @endcond
+ #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
- typedef typename Base::mutex_family mutex_family;
+ typedef typename segment_manager_base_t::mutex_family mutex_family;
typedef transform_iterator
<typename named_index_t::const_iterator, named_transform> const_named_iterator;
typedef transform_iterator
<typename unique_index_t::const_iterator, unique_transform> const_unique_iterator;
- /// @cond
+ #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//!Constructor proxy object definition helper class
template<class T>
@@ -401,52 +406,44 @@ class segment_manager
typedef ipcdetail::named_proxy<segment_manager, T, true> type;
};
- /// @endcond
+ #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
//!Constructor of the segment manager
//!"size" is the size of the memory segment where
//!the segment manager is being constructed.
//!Can throw
- segment_manager(size_type size)
- : Base(size, priv_get_reserved_bytes())
- , m_header(static_cast<Base*>(get_this_pointer()))
+ explicit segment_manager(size_type segment_size)
+ : segment_manager_base_t(segment_size, priv_get_reserved_bytes())
+ , m_header(static_cast<segment_manager_base_t*>(get_this_pointer()))
{
(void) anonymous_instance; (void) unique_instance;
- BOOST_ASSERT(static_cast<const void*>(this) == static_cast<const void*>(static_cast<Base*>(this)));
+ //Check EBO is applied, it's required
+ const void * const this_addr = this;
+ const void *const segm_addr = static_cast<segment_manager_base_t*>(this);
+ (void)this_addr; (void)segm_addr;
+ BOOST_ASSERT( this_addr == segm_addr);
}
- //!Tries to find a previous named allocation. Returns the address
- //!and the object count. On failure the first member of the
- //!returned pair is 0.
- template <class T>
- std::pair<T*, size_type> find (const CharType* name)
- { return this->priv_find_impl<T>(name, true); }
-
- //!Tries to find a previous unique allocation. Returns the address
+ //!Tries to find a previous named/unique allocation. Returns the address
//!and the object count. On failure the first member of the
//!returned pair is 0.
template <class T>
- std::pair<T*, size_type> find (const ipcdetail::unique_instance_t* name)
+ std::pair<T*, size_type> find (char_ptr_holder_t name)
{ return this->priv_find_impl<T>(name, true); }
- //!Tries to find a previous named allocation. Returns the address
+ //!Tries to find a previous named/unique allocation. Returns the address
//!and the object count. On failure the first member of the
//!returned pair is 0. This search is not mutex-protected!
+ //!Use it only inside atomic_func() calls, where the internal mutex
+ //!is guaranteed to be locked.
template <class T>
- std::pair<T*, size_type> find_no_lock (const CharType* name)
- { return this->priv_find_impl<T>(name, false); }
-
- //!Tries to find a previous unique allocation. Returns the address
- //!and the object count. On failure the first member of the
- //!returned pair is 0. This search is not mutex-protected!
- template <class T>
- std::pair<T*, size_type> find_no_lock (const ipcdetail::unique_instance_t* name)
+ std::pair<T*, size_type> find_no_lock (char_ptr_holder_t name)
{ return this->priv_find_impl<T>(name, false); }
//!Returns throwing "construct" proxy
//!object
template <class T>
- typename construct_proxy<T>::type
+ typename construct_proxy<T>::type
construct(char_ptr_holder_t name)
{ return typename construct_proxy<T>::type (this, name, false, true); }
@@ -466,27 +463,27 @@ class segment_manager
//!Returns no throwing "search or construct"
//!proxy object
template <class T>
- typename construct_proxy<T>::type
+ typename construct_proxy<T>::type
find_or_construct(char_ptr_holder_t name, std::nothrow_t)
{ return typename construct_proxy<T>::type (this, name, true, false); }
//!Returns throwing "construct from iterators" proxy object
template <class T>
- typename construct_iter_proxy<T>::type
+ typename construct_iter_proxy<T>::type
construct_it(char_ptr_holder_t name)
{ return typename construct_iter_proxy<T>::type (this, name, false, true); }
//!Returns throwing "search or construct from iterators"
//!proxy object
template <class T>
- typename construct_iter_proxy<T>::type
+ typename construct_iter_proxy<T>::type
find_or_construct_it(char_ptr_holder_t name)
{ return typename construct_iter_proxy<T>::type (this, name, true, true); }
//!Returns no throwing "construct from iterators"
//!proxy object
template <class T>
- typename construct_iter_proxy<T>::type
+ typename construct_iter_proxy<T>::type
construct_it(char_ptr_holder_t name, std::nothrow_t)
{ return typename construct_iter_proxy<T>::type (this, name, false, false); }
@@ -499,7 +496,7 @@ class segment_manager
//!Calls object function blocking recursive interprocess_mutex and guarantees that
//!no new named_alloc or destroy will be executed by any process while
- //!executing the object function call*/
+ //!executing the object function call
template <class Func>
void atomic_func(Func &f)
{ scoped_lock<rmutex> guard(m_header); f(); }
@@ -522,28 +519,26 @@ class segment_manager
}
}
- //!Destroys a previously created unique instance.
+ //!Destroys a previously created named/unique instance.
//!Returns false if the object was not present.
template <class T>
- bool destroy(const ipcdetail::unique_instance_t *)
+ bool destroy(char_ptr_holder_t name)
{
+ BOOST_ASSERT(!name.is_anonymous());
ipcdetail::placement_destroy<T> dtor;
- return this->priv_generic_named_destroy<char>
- (typeid(T).name(), m_header.m_unique_index, dtor, is_intrusive_t());
- }
- //!Destroys the named object with
- //!the given name. Returns false if that object can't be found.
- template <class T>
- bool destroy(const CharType *name)
- {
- ipcdetail::placement_destroy<T> dtor;
- return this->priv_generic_named_destroy<CharType>
- (name, m_header.m_named_index, dtor, is_intrusive_t());
+ if(name.is_unique()){
+ return this->priv_generic_named_destroy<char>
+ ( typeid(T).name(), m_header.m_unique_index , dtor, is_intrusive_t());
+ }
+ else{
+ return this->priv_generic_named_destroy<CharType>
+ ( name.get(), m_header.m_named_index, dtor, is_intrusive_t());
+ }
}
//!Destroys an anonymous, unique or named object
- //!using it's address
+ //!using its address
template <class T>
void destroy_ptr(const T *p)
{
@@ -575,18 +570,18 @@ class segment_manager
//!creation of "num" named objects in the managed memory segment.
//!Can throw boost::interprocess::bad_alloc if there is no enough memory.
void reserve_named_objects(size_type num)
- {
+ {
//-------------------------------
scoped_lock<rmutex> guard(m_header);
//-------------------------------
- m_header.m_named_index.reserve(num);
+ m_header.m_named_index.reserve(num);
}
//!Preallocates needed index resources to optimize the
//!creation of "num" unique objects in the managed memory segment.
//!Can throw boost::interprocess::bad_alloc if there is no enough memory.
void reserve_unique_objects(size_type num)
- {
+ {
//-------------------------------
scoped_lock<rmutex> guard(m_header);
//-------------------------------
@@ -596,38 +591,38 @@ class segment_manager
//!Calls shrink_to_fit in both named and unique object indexes
//!to try to free unused memory from those indexes.
void shrink_to_fit_indexes()
- {
+ {
//-------------------------------
scoped_lock<rmutex> guard(m_header);
//-------------------------------
- m_header.m_named_index.shrink_to_fit();
- m_header.m_unique_index.shrink_to_fit();
+ m_header.m_named_index.shrink_to_fit();
+ m_header.m_unique_index.shrink_to_fit();
}
//!Returns the number of named objects stored in
//!the segment.
size_type get_num_named_objects()
- {
+ {
//-------------------------------
scoped_lock<rmutex> guard(m_header);
//-------------------------------
- return m_header.m_named_index.size();
+ return m_header.m_named_index.size();
}
//!Returns the number of unique objects stored in
//!the segment.
size_type get_num_unique_objects()
- {
+ {
//-------------------------------
scoped_lock<rmutex> guard(m_header);
//-------------------------------
- return m_header.m_unique_index.size();
+ return m_header.m_unique_index.size();
}
//!Obtains the minimum size needed by the
//!segment manager
static size_type get_min_size()
- { return Base::get_min_size(priv_get_reserved_bytes()); }
+ { return segment_manager_base_t::get_min_size(priv_get_reserved_bytes()); }
//!Returns a constant iterator to the beginning of the information about
//!the named allocations performed in this segment manager
@@ -684,14 +679,14 @@ class segment_manager
typedef boost::interprocess::deleter<T, segment_manager> type;
};
- //!Returns an instance of the default allocator for type T
- //!initialized that allocates memory from this segment manager.
+ //!Returns an instance of the default deleter for type T
+ //!that will delete an object constructed in this segment manager.
template<class T>
typename deleter<T>::type
get_deleter()
{ return typename deleter<T>::type(this); }
- /// @cond
+ #if !defined(BOOST_INTERPROCESS_DOXYGEN_INVOKED)
//!Generic named/anonymous new function. Offers all the possibilities,
//!such as throwing, search before creating, and the constructor is
@@ -713,20 +708,20 @@ class segment_manager
//!returned pair is 0.
template <class T>
std::pair<T*, size_type> priv_find_impl (const CharType* name, bool lock)
- {
+ {
//The name can't be null, no anonymous object can be found by name
BOOST_ASSERT(name != 0);
ipcdetail::placement_destroy<T> table;
- size_type size;
+ size_type sz;
void *ret;
if(name == reinterpret_cast<const CharType*>(-1)){
- ret = priv_generic_find<char> (typeid(T).name(), m_header.m_unique_index, table, size, is_intrusive_t(), lock);
+ ret = priv_generic_find<char> (typeid(T).name(), m_header.m_unique_index, table, sz, is_intrusive_t(), lock);
}
else{
- ret = priv_generic_find<CharType> (name, m_header.m_named_index, table, size, is_intrusive_t(), lock);
+ ret = priv_generic_find<CharType> (name, m_header.m_named_index, table, sz, is_intrusive_t(), lock);
}
- return std::pair<T*, size_type>(static_cast<T*>(ret), size);
+ return std::pair<T*, size_type>(static_cast<T*>(ret), sz);
}
//!Tries to find a previous unique allocation. Returns the address
@@ -741,11 +736,8 @@ class segment_manager
return std::pair<T*, size_type>(static_cast<T*>(ret), size);
}
- void *priv_generic_construct(const CharType *name,
- size_type num,
- bool try2find,
- bool dothrow,
- ipcdetail::in_place_interface &table)
+ void *priv_generic_construct
+ (const CharType *name, size_type num, bool try2find, bool dothrow, ipcdetail::in_place_interface &table)
{
void *ret;
//Security overflow check
@@ -799,13 +791,13 @@ class segment_manager
static const CharType *priv_get_instance_name(block_header_t *ctrl_data)
{
boost::interprocess::allocation_type type = ctrl_data->alloc_type();
- if(type != named_type){
+ if(type == anonymous_type){
BOOST_ASSERT((type == anonymous_type && ctrl_data->m_num_char == 0) ||
(type == unique_type && ctrl_data->m_num_char != 0) );
return 0;
}
CharType *name = static_cast<CharType*>(ctrl_data->template name<CharType>());
-
+
//Sanity checks
BOOST_ASSERT(ctrl_data->sizeof_char() == sizeof(CharType));
BOOST_ASSERT(ctrl_data->m_num_char == std::char_traits<CharType>::length(name));
@@ -831,8 +823,8 @@ class segment_manager
static size_type priv_get_reserved_bytes()
{
//Get the number of bytes until the end of (*this)
- //beginning in the end of the Base base.
- return sizeof(segment_manager) - sizeof(Base);
+ //beginning in the end of the segment_manager_base_t base.
+ return sizeof(segment_manager) - sizeof(segment_manager_base_t);
}
template <class CharT>
@@ -840,13 +832,10 @@ class segment_manager
(const CharT* name,
IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
ipcdetail::in_place_interface &table,
- size_type &length,
- ipcdetail::true_ is_intrusive,
- bool use_lock)
+ size_type &length, ipcdetail::true_ is_intrusive, bool use_lock)
{
(void)is_intrusive;
typedef IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > index_type;
- typedef ipcdetail::index_key<CharT, void_pointer> index_key_t;
typedef typename index_type::iterator index_it;
//-------------------------------
@@ -880,9 +869,7 @@ class segment_manager
(const CharT* name,
IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
ipcdetail::in_place_interface &table,
- size_type &length,
- ipcdetail::false_ is_intrusive,
- bool use_lock)
+ size_type &length, ipcdetail::false_ is_intrusive, bool use_lock)
{
(void)is_intrusive;
typedef IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > index_type;
@@ -918,8 +905,7 @@ class segment_manager
bool priv_generic_named_destroy
(block_header_t *block_header,
IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
- ipcdetail::in_place_interface &table,
- ipcdetail::true_ is_node_index)
+ ipcdetail::in_place_interface &table, ipcdetail::true_ is_node_index)
{
(void)is_node_index;
typedef typename IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> >::iterator index_it;
@@ -943,15 +929,13 @@ class segment_manager
template <class CharT>
bool priv_generic_named_destroy(const CharT *name,
IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
- ipcdetail::in_place_interface &table,
- ipcdetail::true_ is_intrusive_index)
+ ipcdetail::in_place_interface &table, ipcdetail::true_ is_intrusive_index)
{
(void)is_intrusive_index;
typedef IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > index_type;
- typedef ipcdetail::index_key<CharT, void_pointer> index_key_t;
typedef typename index_type::iterator index_it;
typedef typename index_type::value_type intrusive_value_type;
-
+
//-------------------------------
scoped_lock<rmutex> guard(m_header);
//-------------------------------
@@ -972,7 +956,7 @@ class segment_manager
void *memory = iv;
void *values = ctrl_data->value();
std::size_t num = ctrl_data->m_value_bytes/table.size;
-
+
//Sanity check
BOOST_ASSERT((ctrl_data->m_value_bytes % table.size) == 0);
BOOST_ASSERT(sizeof(CharT) == ctrl_data->sizeof_char());
@@ -1061,21 +1045,17 @@ class segment_manager
}
//Call destructors and free memory
- std::size_t destroyed;
+ std::size_t destroyed;
table.destroy_n(values, num, destroyed);
this->deallocate(memory);
return true;
}
template<class CharT>
- void * priv_generic_named_construct(unsigned char type,
- const CharT *name,
- size_type num,
- bool try2find,
- bool dothrow,
- ipcdetail::in_place_interface &table,
- IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
- ipcdetail::true_ is_intrusive)
+ void * priv_generic_named_construct
+ (unsigned char type, const CharT *name, size_type num, bool try2find,
+ bool dothrow, ipcdetail::in_place_interface &table,
+ IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index, ipcdetail::true_ is_intrusive)
{
(void)is_intrusive;
std::size_t namelen = std::char_traits<CharT>::length(name);
@@ -1184,7 +1164,7 @@ class segment_manager
//the memory allocation as the intrusive value is built in that
//memory
value_eraser<index_type> v_eraser(index, it);
-
+
//Construct array, this can throw
ipcdetail::array_construct(ptr, num, table);
@@ -1197,14 +1177,10 @@ class segment_manager
//!Generic named new function for
//!named functions
template<class CharT>
- void * priv_generic_named_construct(unsigned char type,
- const CharT *name,
- size_type num,
- bool try2find,
- bool dothrow,
- ipcdetail::in_place_interface &table,
- IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index,
- ipcdetail::false_ is_intrusive)
+ void * priv_generic_named_construct
+ (unsigned char type, const CharT *name, size_type num, bool try2find, bool dothrow,
+ ipcdetail::in_place_interface &table,
+ IndexType<ipcdetail::index_config<CharT, MemoryAlgorithm> > &index, ipcdetail::false_ is_intrusive)
{
(void)is_intrusive;
std::size_t namelen = std::char_traits<CharT>::length(name);
@@ -1346,14 +1322,14 @@ class segment_manager
{
named_index_t m_named_index;
unique_index_t m_unique_index;
-
- header_t(Base *restricted_segment_mngr)
- : m_named_index (restricted_segment_mngr)
- , m_unique_index(restricted_segment_mngr)
+
+ header_t(segment_manager_base_t *segment_mngr_base)
+ : m_named_index (segment_mngr_base)
+ , m_unique_index(segment_mngr_base)
{}
} m_header;
- /// @endcond
+ #endif //#ifndef BOOST_INTERPROCESS_DOXYGEN_INVOKED
};