|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81520 - in trunk/boost/interprocess: . allocators allocators/detail detail ipc mem_algo mem_algo/detail smart_ptr/detail streams sync sync/shm sync/windows
From: igaztanaga_at_[hidden]
Date: 2012-11-24 16:11:59
Author: igaztanaga
Date: 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
New Revision: 81520
URL: http://svn.boost.org/trac/boost/changeset/81520
Log:
* Fixed GCC -Wshadow warnings.
* Experimental multiple allocation interface improved and changed again. Still unstable.
* Replaced deprecated BOOST_NO_XXXX with newer BOOST_NO_CXX11_XXX macros.
* [*ABI breaking]: changed node pool allocators internals for improved efficiency.
Added:
trunk/boost/interprocess/detail/config_external_begin.hpp (contents, props changed)
trunk/boost/interprocess/detail/config_external_end.hpp (contents, props changed)
Text files modified:
trunk/boost/interprocess/allocators/adaptive_pool.hpp | 10 ++--
trunk/boost/interprocess/allocators/allocator.hpp | 25 +++++-------
trunk/boost/interprocess/allocators/cached_adaptive_pool.hpp | 8 ++--
trunk/boost/interprocess/allocators/cached_node_allocator.hpp | 6 +-
trunk/boost/interprocess/allocators/detail/adaptive_node_pool.hpp | 10 ++++-
trunk/boost/interprocess/allocators/detail/allocator_common.hpp | 69 +++++++++++++---------------------
trunk/boost/interprocess/allocators/node_allocator.hpp | 10 ++--
trunk/boost/interprocess/allocators/private_adaptive_pool.hpp | 10 ++--
trunk/boost/interprocess/allocators/private_node_allocator.hpp | 10 ++--
trunk/boost/interprocess/detail/managed_global_memory.hpp | 4 +-
trunk/boost/interprocess/detail/managed_memory_impl.hpp | 44 ++++++++++++---------
trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp | 2
trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp | 16 ++++----
trunk/boost/interprocess/detail/portable_intermodule_singleton.hpp | 6 +-
trunk/boost/interprocess/detail/robust_emulation.hpp | 14 +++---
trunk/boost/interprocess/detail/segment_manager_helper.hpp | 26 ++++++-------
trunk/boost/interprocess/detail/win32_api.hpp | 2
trunk/boost/interprocess/detail/workaround.hpp | 13 ++++++
trunk/boost/interprocess/ipc/message_queue.hpp | 46 +++++++++++-----------
trunk/boost/interprocess/managed_mapped_file.hpp | 28 ++++++++------
trunk/boost/interprocess/managed_shared_memory.hpp | 30 +++++++++------
trunk/boost/interprocess/managed_windows_shared_memory.hpp | 29 ++++++++------
trunk/boost/interprocess/managed_xsi_shared_memory.hpp | 29 +++++++++-----
trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp | 28 +++++++-------
trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp | 31 +++++++--------
trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp | 30 +++++++--------
trunk/boost/interprocess/mem_algo/simple_seq_fit.hpp | 4 +-
trunk/boost/interprocess/segment_manager.hpp | 77 +++++++++++++++++++-------------------
trunk/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp | 4 +-
trunk/boost/interprocess/streams/bufferstream.hpp | 34 ++++++++--------
trunk/boost/interprocess/sync/interprocess_sharable_mutex.hpp | 36 +++++++++---------
trunk/boost/interprocess/sync/interprocess_upgradable_mutex.hpp | 80 ++++++++++++++++++++--------------------
trunk/boost/interprocess/sync/named_sharable_mutex.hpp | 9 ++--
trunk/boost/interprocess/sync/named_upgradable_mutex.hpp | 9 ++--
trunk/boost/interprocess/sync/shm/named_condition.hpp | 9 ++--
trunk/boost/interprocess/sync/shm/named_condition_any.hpp | 9 ++--
trunk/boost/interprocess/sync/shm/named_mutex.hpp | 10 ++---
trunk/boost/interprocess/sync/shm/named_recursive_mutex.hpp | 10 ++---
trunk/boost/interprocess/sync/shm/named_semaphore.hpp | 9 ++--
trunk/boost/interprocess/sync/shm/named_upgradable_mutex.hpp | 9 ++--
trunk/boost/interprocess/sync/windows/sync_utils.hpp | 22 +++++++----
trunk/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp | 14 +++---
42 files changed, 447 insertions(+), 434 deletions(-)
Modified: trunk/boost/interprocess/allocators/adaptive_pool.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/adaptive_pool.hpp (original)
+++ trunk/boost/interprocess/allocators/adaptive_pool.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -400,12 +400,12 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, size_type num_elements);
+ void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
- multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements);
+ void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
//!Allocates many elements of size elem_size in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
@@ -413,7 +413,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- void deallocate_many(multiallocation_chain chain);
+ void deallocate_many(multiallocation_chain &chain);
//!Allocates just one object. Memory allocated with this function
//!must be deallocated only with deallocate_one().
@@ -426,7 +426,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(size_type num_elements);
+ void allocate_individual(size_type num_elements, multiallocation_chain &chain);
//!Deallocates memory previously allocated with allocate_one().
//!You should never use deallocate_one to deallocate memory allocated
@@ -439,7 +439,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- void deallocate_individual(multiallocation_chain it);
+ void deallocate_individual(multiallocation_chain &chain);
#endif
};
Modified: trunk/boost/interprocess/allocators/allocator.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/allocator.hpp (original)
+++ trunk/boost/interprocess/allocators/allocator.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -190,22 +190,20 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- multiallocation_chain allocate_many
- (size_type elem_size, size_type num_elements)
+ void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain)
{
if(size_overflows<sizeof(T)>(elem_size)){
throw bad_alloc();
}
- return multiallocation_chain(mp_mngr->allocate_many(elem_size*sizeof(T), num_elements));
+ mp_mngr->allocate_many(elem_size*sizeof(T), num_elements, chain);
}
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
- multiallocation_chain allocate_many
- (const size_type *elem_sizes, size_type n_elements)
+ void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain)
{
- multiallocation_chain(mp_mngr->allocate_many(elem_sizes, n_elements, sizeof(T)));
+ mp_mngr->allocate_many(elem_sizes, n_elements, sizeof(T), chain);
}
//!Allocates many elements of size elem_size in a contiguous block
@@ -214,10 +212,8 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- void deallocate_many(multiallocation_chain chain)
- {
- return mp_mngr->deallocate_many(chain.extract_multiallocation_chain());
- }
+ void deallocate_many(multiallocation_chain &chain)
+ { mp_mngr->deallocate_many(chain); }
//!Allocates just one object. Memory allocated with this function
//!must be deallocated only with deallocate_one().
@@ -231,9 +227,8 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual
- (size_type num_elements)
- { return this->allocate_many(1, num_elements); }
+ void allocate_individual(size_type num_elements, multiallocation_chain &chain)
+ { this->allocate_many(1, num_elements, chain); }
//!Deallocates memory previously allocated with allocate_one().
//!You should never use deallocate_one to deallocate memory allocated
@@ -247,8 +242,8 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- void deallocate_individual(multiallocation_chain chain)
- { return this->deallocate_many(boost::move(chain)); }
+ void deallocate_individual(multiallocation_chain &chain)
+ { this->deallocate_many(chain); }
//!Returns address of mutable object.
//!Never throws
Modified: trunk/boost/interprocess/allocators/cached_adaptive_pool.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/cached_adaptive_pool.hpp (original)
+++ trunk/boost/interprocess/allocators/cached_adaptive_pool.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -280,12 +280,12 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, size_type num_elements);
+ void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
- multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements);
+ void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
//!Allocates many elements of size elem_size in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
@@ -293,7 +293,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- void deallocate_many(multiallocation_chain chain);
+ void deallocate_many(multiallocation_chain &chain);
//!Allocates just one object. Memory allocated with this function
//!must be deallocated only with deallocate_one().
@@ -319,7 +319,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- void deallocate_individual(multiallocation_chain chain);
+ void deallocate_individual(multiallocation_chain &chain);
//!Sets the new max cached nodes value. This can provoke deallocations
//!if "newmax" is less than current cached nodes. Never throws
void set_max_cached_nodes(size_type newmax);
Modified: trunk/boost/interprocess/allocators/cached_node_allocator.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/cached_node_allocator.hpp (original)
+++ trunk/boost/interprocess/allocators/cached_node_allocator.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -252,12 +252,12 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, size_type num_elements);
+ void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
- multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements);
+ void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
//!Allocates many elements of size elem_size in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
@@ -265,7 +265,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- void deallocate_many(multiallocation_chain chain);
+ void deallocate_many(multiallocation_chain &chain);
//!Allocates just one object. Memory allocated with this function
//!must be deallocated only with deallocate_one().
Modified: trunk/boost/interprocess/allocators/detail/adaptive_node_pool.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/detail/adaptive_node_pool.hpp (original)
+++ trunk/boost/interprocess/allocators/detail/adaptive_node_pool.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -45,10 +45,16 @@
>
class private_adaptive_node_pool
: public boost::container::container_detail::private_adaptive_node_pool_impl
- <typename SegmentManager::segment_manager_base_type>
+ < 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
- <typename SegmentManager::segment_manager_base_type> base_t;
+ < typename SegmentManager::segment_manager_base_type
+ , ::boost::container::adaptive_pool_flag::size_ordered |
+ ::boost::container::adaptive_pool_flag::address_ordered
+ > base_t;
//Non-copyable
private_adaptive_node_pool();
private_adaptive_node_pool(const private_adaptive_node_pool &);
Modified: trunk/boost/interprocess/allocators/detail/allocator_common.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/detail/allocator_common.hpp (original)
+++ trunk/boost/interprocess/allocators/detail/allocator_common.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -189,15 +189,14 @@
{
//If don't have any cached node, we have to get a new list of free nodes from the pool
if(m_cached_nodes.empty()){
- m_cached_nodes = mp_node_pool->allocate_nodes(m_max_cached_nodes/2);
+ mp_node_pool->allocate_nodes(m_max_cached_nodes/2, m_cached_nodes);
}
void *ret = ipcdetail::to_raw_pointer(m_cached_nodes.pop_front());
return ret;
}
- multiallocation_chain cached_allocation(size_type n)
+ void cached_allocation(size_type n, multiallocation_chain &chain)
{
- multiallocation_chain chain;
size_type count = n, allocated(0);
BOOST_TRY{
//If don't have any cached node, we have to get a new list of free nodes from the pool
@@ -208,13 +207,11 @@
}
if(allocated != n){
- multiallocation_chain chain2(mp_node_pool->allocate_nodes(n - allocated));
- chain.splice_after(chain.last(), chain2, chain2.before_begin(), chain2.last(), n - allocated);
+ mp_node_pool->allocate_nodes(n - allocated, chain);
}
- return boost::move(chain);
}
BOOST_CATCH(...){
- this->cached_deallocation(boost::move(chain));
+ this->cached_deallocation(chain);
BOOST_RETHROW
}
BOOST_CATCH_END
@@ -233,7 +230,7 @@
m_cached_nodes.push_front(ptr);
}
- void cached_deallocation(multiallocation_chain chain)
+ void cached_deallocation(multiallocation_chain &chain)
{
m_cached_nodes.splice_after(m_cached_nodes.before_begin(), chain);
@@ -260,7 +257,7 @@
void deallocate_all_cached_nodes()
{
if(m_cached_nodes.empty()) return;
- mp_node_pool->deallocate_nodes(boost::move(m_cached_nodes));
+ mp_node_pool->deallocate_nodes(m_cached_nodes);
}
private:
@@ -288,7 +285,7 @@
multiallocation_chain chain;
chain.splice_after(chain.before_begin(), m_cached_nodes, m_cached_nodes.before_begin(), it, n);
//Deallocate all new linked list at once
- mp_node_pool->deallocate_nodes(boost::move(chain));
+ mp_node_pool->deallocate_nodes(chain);
}
public:
@@ -353,20 +350,20 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, size_type num_elements)
+ void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain)
{
if(size_overflows<sizeof(T)>(elem_size)){
throw bad_alloc();
}
- return this->derived()->get_segment_manager()->allocate_many(elem_size*sizeof(T), num_elements);
+ this->derived()->get_segment_manager()->allocate_many(elem_size*sizeof(T), num_elements, chain);
}
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
- multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements)
+ void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain)
{
- return this->derived()->get_segment_manager()->allocate_many(elem_sizes, n_elements, sizeof(T));
+ this->derived()->get_segment_manager()->allocate_many(elem_sizes, n_elements, sizeof(T), chain);
}
//!Allocates many elements of size elem_size in a contiguous block
@@ -375,8 +372,8 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- void deallocate_many(multiallocation_chain chain)
- { return this->derived()->get_segment_manager()->deallocate_many(boost::move(chain)); }
+ void deallocate_many(multiallocation_chain &chain)
+ { this->derived()->get_segment_manager()->deallocate_many(chain); }
//!Returns the number of elements that could be
//!allocated. Never throws
@@ -499,11 +496,11 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(size_type num_elements)
+ void allocate_individual(size_type num_elements, multiallocation_chain &chain)
{
typedef typename node_pool<0>::type node_pool_t;
node_pool_t *pool = node_pool<0>::get(this->derived()->get_node_pool());
- return multiallocation_chain(pool->allocate_nodes(num_elements));
+ pool->allocate_nodes(num_elements, chain);
}
//!Deallocates memory previously allocated with allocate_one().
@@ -522,10 +519,10 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- void deallocate_individual(multiallocation_chain chain)
+ void deallocate_individual(multiallocation_chain &chain)
{
node_pool<0>::get(this->derived()->get_node_pool())->deallocate_nodes
- (chain.extract_multiallocation_chain());
+ (chain);
}
//!Deallocates all free blocks of the pool
@@ -645,8 +642,8 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(size_type num_elements)
- { return multiallocation_chain(this->m_cache.cached_allocation(num_elements)); }
+ void allocate_individual(size_type num_elements, multiallocation_chain &chain)
+ { this->m_cache.cached_allocation(num_elements, chain); }
//!Deallocates memory previously allocated with allocate_one().
//!You should never use deallocate_one to deallocate memory allocated
@@ -660,12 +657,8 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- void deallocate_individual(multiallocation_chain chain)
- {
- typename node_pool_t::multiallocation_chain mem
- (chain.extract_multiallocation_chain());
- m_cache.cached_deallocation(boost::move(mem));
- }
+ void deallocate_individual(multiallocation_chain &chain)
+ { m_cache.cached_deallocation(chain); }
//!Deallocates all free blocks of the pool
void deallocate_free_blocks()
@@ -750,25 +743,15 @@
//-----------------------
private_node_allocator_t::deallocate_node(ptr);
}
-/*
- //!Allocates a singly linked list of n nodes ending in null pointer.
- //!can throw boost::interprocess::bad_alloc
- void allocate_nodes(multiallocation_chain &nodes, size_type n)
- {
- //-----------------------
- boost::interprocess::scoped_lock<mutex_type> guard(m_header);
- //-----------------------
- return private_node_allocator_t::allocate_nodes(nodes, n);
- }
-*/
+
//!Allocates n nodes.
//!Can throw boost::interprocess::bad_alloc
- multiallocation_chain allocate_nodes(const size_type n)
+ void allocate_nodes(const size_type n, multiallocation_chain &chain)
{
//-----------------------
boost::interprocess::scoped_lock<mutex_type> guard(m_header);
//-----------------------
- return private_node_allocator_t::allocate_nodes(n);
+ private_node_allocator_t::allocate_nodes(n, chain);
}
//!Deallocates a linked list of nodes ending in null pointer. Never throws
@@ -781,12 +764,12 @@
}
//!Deallocates the nodes pointed by the multiallocation iterator. Never throws
- void deallocate_nodes(multiallocation_chain chain)
+ void deallocate_nodes(multiallocation_chain &chain)
{
//-----------------------
boost::interprocess::scoped_lock<mutex_type> guard(m_header);
//-----------------------
- private_node_allocator_t::deallocate_nodes(boost::move(chain));
+ private_node_allocator_t::deallocate_nodes(chain);
}
//!Deallocates all the free blocks of memory. Never throws
Modified: trunk/boost/interprocess/allocators/node_allocator.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/node_allocator.hpp (original)
+++ trunk/boost/interprocess/allocators/node_allocator.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -385,12 +385,12 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, size_type num_elements);
+ void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
- multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements);
+ void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
//!Allocates many elements of size elem_size in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
@@ -398,7 +398,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- void deallocate_many(multiallocation_chain chain);
+ void deallocate_many(multiallocation_chain &chain);
//!Allocates just one object. Memory allocated with this function
//!must be deallocated only with deallocate_one().
@@ -411,7 +411,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(size_type num_elements);
+ void allocate_individual(size_type num_elements, multiallocation_chain &chain);
//!Deallocates memory previously allocated with allocate_one().
//!You should never use deallocate_one to deallocate memory allocated
@@ -424,7 +424,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- void deallocate_individual(multiallocation_chain chain);
+ void deallocate_individual(multiallocation_chain &chain);
#endif
};
Modified: trunk/boost/interprocess/allocators/private_adaptive_pool.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/private_adaptive_pool.hpp (original)
+++ trunk/boost/interprocess/allocators/private_adaptive_pool.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -400,12 +400,12 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, size_type num_elements);
+ void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
- multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements);
+ void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
//!Allocates many elements of size elem_size in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
@@ -413,7 +413,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- void deallocate_many(multiallocation_chain chain);
+ void deallocate_many(multiallocation_chain &chain);
//!Allocates just one object. Memory allocated with this function
//!must be deallocated only with deallocate_one().
@@ -426,7 +426,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(size_type num_elements);
+ void allocate_individual(size_type num_elements, multiallocation_chain &chain);
//!Deallocates memory previously allocated with allocate_one().
//!You should never use deallocate_one to deallocate memory allocated
@@ -439,7 +439,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- void deallocate_individual(multiallocation_chain chain);
+ void deallocate_individual(multiallocation_chain &chain);
#endif
};
Modified: trunk/boost/interprocess/allocators/private_node_allocator.hpp
==============================================================================
--- trunk/boost/interprocess/allocators/private_node_allocator.hpp (original)
+++ trunk/boost/interprocess/allocators/private_node_allocator.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -377,12 +377,12 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- multiallocation_chain allocate_many(size_type elem_size, size_type num_elements);
+ void allocate_many(size_type elem_size, size_type num_elements, multiallocation_chain &chain);
//!Allocates n_elements elements, each one of size elem_sizes[i]in a
//!contiguous block
//!of memory. The elements must be deallocated
- multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements);
+ void allocate_many(const size_type *elem_sizes, size_type n_elements, multiallocation_chain &chain);
//!Allocates many elements of size elem_size in a contiguous block
//!of memory. The minimum number to be allocated is min_elements,
@@ -390,7 +390,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. The elements must be deallocated
//!with deallocate(...)
- void deallocate_many(multiallocation_chain chain);
+ void deallocate_many(multiallocation_chain &chain);
//!Allocates just one object. Memory allocated with this function
//!must be deallocated only with deallocate_one().
@@ -403,7 +403,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- multiallocation_chain allocate_individual(size_type num_elements);
+ void allocate_individual(size_type num_elements, multiallocation_chain &chain);
//!Deallocates memory previously allocated with allocate_one().
//!You should never use deallocate_one to deallocate memory allocated
@@ -416,7 +416,7 @@
//!preferred_elements. The number of actually allocated elements is
//!will be assigned to received_size. Memory allocated with this function
//!must be deallocated only with deallocate_one().
- void deallocate_individual(multiallocation_chain chain);
+ void deallocate_individual(multiallocation_chain &chain);
#endif
};
Added: trunk/boost/interprocess/detail/config_external_begin.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/detail/config_external_begin.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -0,0 +1,18 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2012-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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_INTERPROCESS_EXTERNAL_CONFIG_INCLUDED
+#define BOOST_INTERPROCESS_EXTERNAL_CONFIG_INCLUDED
+#include <boost/config.hpp>
+#endif
+
+#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 406)
+# pragma GCC diagnostic push
+# pragma GCC diagnostic ignored "-Wshadow"
+#endif
Added: trunk/boost/interprocess/detail/config_external_end.hpp
==============================================================================
--- (empty file)
+++ trunk/boost/interprocess/detail/config_external_end.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -0,0 +1,12 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2012-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)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+#if defined(__GNUC__) && ((__GNUC__*100 + __GNUC_MINOR__) >= 406)
+# pragma GCC diagnostic pop
+#endif
Modified: trunk/boost/interprocess/detail/managed_global_memory.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_global_memory.hpp (original)
+++ trunk/boost/interprocess/detail/managed_global_memory.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -23,7 +23,7 @@
#include <boost/interprocess/sync/spin/recursive_mutex.hpp>
#include <boost/interprocess/detail/managed_memory_impl.hpp>
#include <boost/interprocess/detail/managed_open_or_create_impl.hpp>
-#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
+#include <boost/interprocess/mem_algo/rbtree_best_fit.hpp>
#include <boost/interprocess/indexes/iset_index.hpp>
#include <boost/interprocess/creation_tags.hpp>
#include <boost/interprocess/permissions.hpp>
@@ -47,7 +47,7 @@
struct open_or_create
{
typedef managed_open_or_create_impl
- <Device, mem_algo::Alignment, FileBased> type;
+ <Device, mem_algo::Alignment, FileBased, false> type;
};
};
Modified: trunk/boost/interprocess/detail/managed_memory_impl.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_memory_impl.hpp (original)
+++ trunk/boost/interprocess/detail/managed_memory_impl.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -307,25 +307,31 @@
//Experimental. Don't use.
- //!Allocates n_elements of elem_size bytes.
- multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements)
- { return mp_header->allocate_many(elem_bytes, num_elements); }
-
- //!Allocates n_elements, each one of elem_sizes[i] bytes.
- multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements)
- { return mp_header->allocate_many(elem_sizes, n_elements); }
-
- //!Allocates n_elements of elem_size bytes.
- multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements, std::nothrow_t nothrow)
- { return mp_header->allocate_many(elem_bytes, num_elements, nothrow); }
-
- //!Allocates n_elements, each one of elem_sizes[i] bytes.
- multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements, std::nothrow_t nothrow)
- { return mp_header->allocate_many(elem_sizes, n_elements, nothrow); }
-
- //!Allocates n_elements, each one of elem_sizes[i] bytes.
- void deallocate_many(multiallocation_chain chain)
- { return mp_header->deallocate_many(boost::move(chain)); }
+ //!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)
+ { mp_header->allocate_many(elem_bytes, n_elements, chain); }
+
+ //!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)
+ { mp_header->allocate_many(element_lengths, n_elements, sizeof_element, chain); }
+
+ //!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)
+ { mp_header->allocate_many(std::nothrow_t(), elem_bytes, n_elements, chain); }
+
+ //!Allocates n_elements, each one of
+ //!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)
+ { mp_header->allocate_many(std::nothrow_t(), elem_sizes, n_elements, sizeof_element, chain); }
+
+ //!Deallocates all elements contained in chain.
+ //!Never throws.
+ void deallocate_many(multiallocation_chain &chain)
+ { mp_header->deallocate_many(chain); }
/// @endcond
Modified: trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp (original)
+++ trunk/boost/interprocess/detail/managed_multi_shared_memory.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -72,7 +72,7 @@
typedef typename MemoryAlgorithm::void_pointer void_pointer;
typedef typename ipcdetail::
- managed_open_or_create_impl<shared_memory_object, MemoryAlgorithm::Alignment> managed_impl;
+ managed_open_or_create_impl<shared_memory_object, MemoryAlgorithm::Alignment, true, false> managed_impl;
typedef typename void_pointer::segment_group_id segment_group_id;
typedef typename base_t::size_type size_type;
Modified: trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp
==============================================================================
--- trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp (original)
+++ trunk/boost/interprocess/detail/managed_open_or_create_impl.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -84,7 +84,7 @@
DeviceAbstraction dev;
};
-template<class DeviceAbstraction, std::size_t MemAlignment = 0, bool FileBased = true, bool StoreDevice = true>
+template<class DeviceAbstraction, std::size_t MemAlignment, bool FileBased, bool StoreDevice>
class managed_open_or_create_impl
: public managed_open_or_create_impl_device_holder<StoreDevice, DeviceAbstraction>
{
@@ -366,8 +366,8 @@
created = false;
completed = true;
}
- catch(interprocess_exception &ex){
- if(ex.get_error_code() != not_found_error){
+ catch(interprocess_exception &e){
+ if(e.get_error_code() != not_found_error){
throw;
}
}
@@ -461,6 +461,11 @@
}
}
+ friend void swap(managed_open_or_create_impl &left, managed_open_or_create_impl &right)
+ {
+ left.swap(right);
+ }
+
private:
friend class interprocess_tester;
void dont_close_on_destruction()
@@ -469,11 +474,6 @@
mapped_region m_mapped_region;
};
-template<class DeviceAbstraction>
-inline void swap(managed_open_or_create_impl<DeviceAbstraction> &x
- ,managed_open_or_create_impl<DeviceAbstraction> &y)
-{ x.swap(y); }
-
} //namespace ipcdetail {
} //namespace interprocess {
Modified: trunk/boost/interprocess/detail/portable_intermodule_singleton.hpp
==============================================================================
--- trunk/boost/interprocess/detail/portable_intermodule_singleton.hpp (original)
+++ trunk/boost/interprocess/detail/portable_intermodule_singleton.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -222,11 +222,11 @@
//Create a unique current pid based lock file path
create_and_get_singleton_lock_file_path(lck_str);
//Open or create and lock file
- int fd = open_or_create_and_lock_file(lck_str.c_str());
+ int fd_lockfile = open_or_create_and_lock_file(lck_str.c_str());
//If failed, write a bad file descriptor to notify other modules that
//something was wrong and unlink shared memory. Mark the function object
//to tell caller to retry with another shared memory
- if(fd < 0){
+ if(fd_lockfile < 0){
this->register_lock_file(GMemMarkToBeRemoved);
std::string s;
get_map_name(s);
@@ -235,7 +235,7 @@
}
//If successful, register the file descriptor
else{
- this->register_lock_file(fd);
+ this->register_lock_file(fd_lockfile);
}
}
//If the fd was invalid (maybe a previous try failed) notify caller that
Modified: trunk/boost/interprocess/detail/robust_emulation.hpp
==============================================================================
--- trunk/boost/interprocess/detail/robust_emulation.hpp (original)
+++ trunk/boost/interprocess/detail/robust_emulation.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -197,8 +197,8 @@
bool lock_own_unique_file();
bool robust_check();
bool check_if_owner_dead_and_take_ownership_atomically();
- bool is_owner_dead(boost::uint32_t owner);
- void owner_to_filename(boost::uint32_t owner, std::string &s);
+ bool is_owner_dead(boost::uint32_t own);
+ void owner_to_filename(boost::uint32_t own, std::string &s);
//The real mutex
Mutex mtx;
//The pid of the owner
@@ -309,9 +309,9 @@
}
template<class Mutex>
-inline void robust_spin_mutex<Mutex>::owner_to_filename(boost::uint32_t owner, std::string &s)
+inline void robust_spin_mutex<Mutex>::owner_to_filename(boost::uint32_t own, std::string &s)
{
- robust_emulation_helpers::create_and_get_robust_lock_file_path(s, owner);
+ robust_emulation_helpers::create_and_get_robust_lock_file_path(s, own);
}
template<class Mutex>
@@ -349,16 +349,16 @@
}
template<class Mutex>
-inline bool robust_spin_mutex<Mutex>::is_owner_dead(boost::uint32_t owner)
+inline bool robust_spin_mutex<Mutex>::is_owner_dead(boost::uint32_t own)
{
//If owner is an invalid id, then it's clear it's dead
- if(owner == (boost::uint32_t)get_invalid_process_id()){
+ if(own == (boost::uint32_t)get_invalid_process_id()){
return true;
}
//Obtain the lock filename of the owner field
std::string file;
- this->owner_to_filename(owner, file);
+ this->owner_to_filename(own, file);
//Now the logic is to open and lock it
file_handle_t fhnd = open_existing_file(file.c_str(), read_write);
Modified: trunk/boost/interprocess/detail/segment_manager_helper.hpp
==============================================================================
--- trunk/boost/interprocess/detail/segment_manager_helper.hpp (original)
+++ trunk/boost/interprocess/detail/segment_manager_helper.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -81,21 +81,18 @@
unsigned char m_value_alignment;
unsigned char m_alloc_type_sizeof_char;
- block_header(size_type value_bytes
- ,size_type value_alignment
- ,unsigned char alloc_type
- ,std::size_t sizeof_char
+ block_header(size_type val_bytes
+ ,size_type val_alignment
+ ,unsigned char al_type
+ ,std::size_t szof_char
,std::size_t num_char
)
- : m_value_bytes(value_bytes)
+ : m_value_bytes(val_bytes)
, m_num_char((unsigned short)num_char)
- , m_value_alignment((unsigned char)value_alignment)
- , m_alloc_type_sizeof_char
- ( (alloc_type << 5u) |
- ((unsigned char)sizeof_char & 0x1F) )
+ , m_value_alignment((unsigned char)val_alignment)
+ , m_alloc_type_sizeof_char( (al_type << 5u) | ((unsigned char)szof_char & 0x1F) )
{};
-
template<class T>
block_header &operator= (const T& )
{ return *this; }
@@ -350,8 +347,9 @@
public:
//!Constructor of the key
- index_key (const char_type *name, size_type length)
- : mp_str(name), m_len(length) {}
+ index_key (const char_type *nm, size_type length)
+ : mp_str(nm), m_len(length)
+ {}
//!Less than function for index ordering
bool operator < (const index_key & right) const
@@ -372,8 +370,8 @@
to_raw_pointer(right.mp_str), m_len) == 0;
}
- void name(const CharT *name)
- { mp_str = name; }
+ void name(const CharT *nm)
+ { mp_str = nm; }
void name_length(size_type len)
{ m_len = len; }
Modified: trunk/boost/interprocess/detail/win32_api.hpp
==============================================================================
--- trunk/boost/interprocess/detail/win32_api.hpp (original)
+++ trunk/boost/interprocess/detail/win32_api.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -21,7 +21,7 @@
#include <vector>
#include <memory>
-#if (defined _MSC_VER) && (_MSC_VER >= 1200)
+#if defined (_MSC_VER) && (_MSC_VER >= 1200)
# pragma once
# pragma comment( lib, "advapi32.lib" )
# pragma comment( lib, "oleaut32.lib" )
Modified: trunk/boost/interprocess/detail/workaround.hpp
==============================================================================
--- trunk/boost/interprocess/detail/workaround.hpp (original)
+++ trunk/boost/interprocess/detail/workaround.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -22,7 +22,7 @@
#if defined(_POSIX_THREAD_PROCESS_SHARED) && ((_POSIX_THREAD_PROCESS_SHARED - 0) > 0)
//Cygwin defines _POSIX_THREAD_PROCESS_SHARED but does not implement it.
- //Mac Os X >= Leopard defines _POSIX_THREAD_PROCESS_SHARED but does not seems to work.
+ //Mac Os X >= Leopard defines _POSIX_THREAD_PROCESS_SHARED but does not seem to work.
#if !defined(__CYGWIN__) && !defined(__APPLE__)
#define BOOST_INTERPROCESS_POSIX_PROCESS_SHARED
#endif
@@ -154,6 +154,17 @@
#define BOOST_INTERPROCESS_NEVER_INLINE __attribute__((__noinline__))
#endif
+#if defined(BOOST_NO_NOEXCEPT)
+ #if defined(BOOST_MSVC)
+ #define BOOST_INTERPROCESS_NOEXCEPT throw()
+ #else
+ #define BOOST_INTERPROCESS_NOEXCEPT
+ #endif
+ #define BOOST_INTERPROCESS_NOEXCEPT_IF(x)
+#else
+ #define BOOST_INTERPROCESS_NOEXCEPT noexcept
+ #define BOOST_INTERPROCESS_NOEXCEPT_IF(x) noexcept(x)
+#endif
#include <boost/interprocess/detail/config_end.hpp>
Modified: trunk/boost/interprocess/ipc/message_queue.hpp
==============================================================================
--- trunk/boost/interprocess/ipc/message_queue.hpp (original)
+++ trunk/boost/interprocess/ipc/message_queue.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -176,8 +176,8 @@
//!Returns the needed memory size for the shared message queue.
//!Never throws
static size_type get_mem_size(size_type max_msg_size, size_type max_num_msg);
-
- ipcdetail::managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t;
+ open_create_impl_t m_shmem;
/// @endcond
};
@@ -283,6 +283,7 @@
typedef typename boost::intrusive::
pointer_traits<void_pointer>::template
rebind_pointer<msg_hdr_ptr_t>::type msg_hdr_ptr_ptr_t;
+ typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t;
public:
//!Constructor. This object must be constructed in the beginning of the
@@ -363,13 +364,13 @@
msg_header & insert_at(iterator where)
{
- iterator inserted_ptr_end = this->inserted_ptr_end();
- iterator inserted_ptr_beg = this->inserted_ptr_begin();
- if(where == inserted_ptr_end){
+ iterator it_inserted_ptr_end = this->inserted_ptr_end();
+ iterator it_inserted_ptr_beg = this->inserted_ptr_begin();
+ if(where == it_inserted_ptr_end){
++m_cur_num_msg;
- return **inserted_ptr_end;
+ return **it_inserted_ptr_end;
}
- else if(where == inserted_ptr_beg){
+ else if(where == it_inserted_ptr_beg){
//unsigned integer guarantees underflow
m_cur_first_msg = m_cur_first_msg ? m_cur_first_msg : m_max_num_msg;
--m_cur_first_msg;
@@ -391,10 +392,10 @@
--where;
}
const bool unique_segment = m_cur_first_msg && m_cur_first_msg <= pos;
- size_type first_segment_beg = unique_segment ? m_cur_first_msg : 1u;
- size_type first_segment_end = pos;
- size_type second_segment_beg = unique_segment || !m_cur_first_msg ? m_max_num_msg : m_cur_first_msg;
- size_type second_segment_end = m_max_num_msg;
+ const size_type first_segment_beg = unique_segment ? m_cur_first_msg : 1u;
+ const size_type first_segment_end = pos;
+ const size_type second_segment_beg = unique_segment || !m_cur_first_msg ? m_max_num_msg : m_cur_first_msg;
+ const size_type second_segment_end = m_max_num_msg;
const msg_hdr_ptr_t backup = *(&mp_index[0] + (unique_segment ? first_segment_beg : second_segment_beg) - 1);
//First segment
@@ -416,13 +417,13 @@
else{
//The queue can't be full so end_pos < m_cur_first_msg
//indicates two step insertion
- const size_type end_pos = this->end_pos();
- const bool unique_segment = pos < end_pos;
- size_type first_segment_beg = pos;
- size_type first_segment_end = unique_segment ? end_pos : m_max_num_msg-1;
- size_type second_segment_beg = 0u;
- size_type second_segment_end = unique_segment ? 0u : end_pos;
- const msg_hdr_ptr_t backup = *inserted_ptr_end;
+ const size_type pos_end = this->end_pos();
+ const bool unique_segment = pos < pos_end;
+ const size_type first_segment_beg = pos;
+ const size_type first_segment_end = unique_segment ? pos_end : m_max_num_msg-1;
+ const size_type second_segment_beg = 0u;
+ const size_type second_segment_end = unique_segment ? 0u : pos_end;
+ const msg_hdr_ptr_t backup = *it_inserted_ptr_end;
//First segment
if(!unique_segment){
@@ -515,7 +516,7 @@
r_index_size = ipcdetail::get_rounded_size(max_num_msg*sizeof(msg_hdr_ptr_t), msg_hdr_align),
r_max_msg_size = ipcdetail::get_rounded_size(max_msg_size, msg_hdr_align) + sizeof(msg_header);
return r_hdr_size + r_index_size + (max_num_msg*r_max_msg_size) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::ManagedOpenOrCreateUserOffset;
+ open_create_impl_t::ManagedOpenOrCreateUserOffset;
}
//!Initializes the memory structures to preallocate messages and constructs the
@@ -619,7 +620,7 @@
{ return ipcdetail::mq_hdr_t<VoidPointer>::get_mem_size(max_msg_size, max_num_msg); }
template<class VoidPointer>
-inline message_queue_t<VoidPointer>::message_queue_t(create_only_t create_only,
+inline message_queue_t<VoidPointer>::message_queue_t(create_only_t,
const char *name,
size_type max_num_msg,
size_type max_msg_size,
@@ -636,7 +637,7 @@
{}
template<class VoidPointer>
-inline message_queue_t<VoidPointer>::message_queue_t(open_or_create_t open_or_create,
+inline message_queue_t<VoidPointer>::message_queue_t(open_or_create_t,
const char *name,
size_type max_num_msg,
size_type max_msg_size,
@@ -653,8 +654,7 @@
{}
template<class VoidPointer>
-inline message_queue_t<VoidPointer>::message_queue_t(open_only_t open_only,
- const char *name)
+inline message_queue_t<VoidPointer>::message_queue_t(open_only_t, const char *name)
//Create shared memory and execute functor atomically
: m_shmem(open_only,
name,
Modified: trunk/boost/interprocess/managed_mapped_file.hpp
==============================================================================
--- trunk/boost/interprocess/managed_mapped_file.hpp (original)
+++ trunk/boost/interprocess/managed_mapped_file.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -32,6 +32,16 @@
namespace boost {
namespace interprocess {
+namespace ipcdetail {
+
+template<class AllocationAlgorithm>
+struct mfile_open_or_create
+{
+ typedef ipcdetail::managed_open_or_create_impl
+ < file_wrapper, AllocationAlgorithm::Alignment, true, false> type;
+};
+
+} //namespace ipcdetail {
//!A basic mapped file named object creation class. Initializes the
//!mapped file. Inherits all basic functionality from
@@ -45,25 +55,19 @@
class basic_managed_mapped_file
: public ipcdetail::basic_managed_memory_impl
<CharType, AllocationAlgorithm, IndexType
- ,ipcdetail::managed_open_or_create_impl< ipcdetail::file_wrapper
- , AllocationAlgorithm::Alignment>::ManagedOpenOrCreateUserOffset
- >
+ ,ipcdetail::mfile_open_or_create<AllocationAlgorithm>::type::ManagedOpenOrCreateUserOffset>
{
/// @cond
public:
typedef ipcdetail::basic_managed_memory_impl
<CharType, AllocationAlgorithm, IndexType,
- ipcdetail::managed_open_or_create_impl
- <ipcdetail::file_wrapper, AllocationAlgorithm::Alignment>::ManagedOpenOrCreateUserOffset
- > base_t;
+ ipcdetail::mfile_open_or_create<AllocationAlgorithm>::type::ManagedOpenOrCreateUserOffset> base_t;
typedef ipcdetail::file_wrapper device_type;
typedef typename base_t::size_type size_type;
private:
typedef ipcdetail::create_open_func<base_t> create_open_func_t;
- typedef ipcdetail::managed_open_or_create_impl< ipcdetail::file_wrapper
- , AllocationAlgorithm::Alignment> managed_open_or_create_type;
basic_managed_mapped_file *get_this_pointer()
{ return this; }
@@ -82,7 +86,7 @@
//!Creates mapped file and creates and places the segment manager.
//!This can throw.
- basic_managed_mapped_file(create_only_t create_only, const char *name,
+ basic_managed_mapped_file(create_only_t, const char *name,
size_type size, const void *addr = 0, const permissions &perm = permissions())
: m_mfile(create_only, name, size, read_write, addr,
create_open_func_t(get_this_pointer(), ipcdetail::DoCreate), perm)
@@ -92,7 +96,7 @@
//!segment was not created. If segment was created it connects to the
//!segment.
//!This can throw.
- basic_managed_mapped_file (open_or_create_t open_or_create,
+ basic_managed_mapped_file (open_or_create_t,
const char *name, size_type size,
const void *addr = 0, const permissions &perm = permissions())
: m_mfile(open_or_create, name, size, read_write, addr,
@@ -102,7 +106,7 @@
//!Connects to a created mapped file and its segment manager.
//!This can throw.
- basic_managed_mapped_file (open_only_t open_only, const char* name,
+ basic_managed_mapped_file (open_only_t, const char* name,
const void *addr = 0)
: m_mfile(open_only, name, read_write, addr,
create_open_func_t(get_this_pointer(),
@@ -205,7 +209,7 @@
}
private:
- managed_open_or_create_type m_mfile;
+ typename ipcdetail::mfile_open_or_create<AllocationAlgorithm>::type m_mfile;
/// @endcond
};
Modified: trunk/boost/interprocess/managed_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/managed_shared_memory.hpp (original)
+++ trunk/boost/interprocess/managed_shared_memory.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -29,9 +29,19 @@
#include <boost/interprocess/sync/mutex_family.hpp>
namespace boost {
-
namespace interprocess {
+namespace ipcdetail {
+
+template<class AllocationAlgorithm>
+struct shmem_open_or_create
+{
+ typedef ipcdetail::managed_open_or_create_impl
+ < shared_memory_object, AllocationAlgorithm::Alignment, true, false> type;
+};
+
+} //namespace ipcdetail {
+
//!A basic shared memory named object creation class. Initializes the
//!shared memory segment. Inherits all basic functionality from
//!basic_managed_memory_impl<CharType, AllocationAlgorithm, IndexType>*/
@@ -44,18 +54,14 @@
class basic_managed_shared_memory
: public ipcdetail::basic_managed_memory_impl
<CharType, AllocationAlgorithm, IndexType
- ,ipcdetail::managed_open_or_create_impl<shared_memory_object
- , AllocationAlgorithm::Alignment>::ManagedOpenOrCreateUserOffset>
- , private ipcdetail::managed_open_or_create_impl<shared_memory_object
- , AllocationAlgorithm::Alignment>
+ ,ipcdetail::shmem_open_or_create<AllocationAlgorithm>::type::ManagedOpenOrCreateUserOffset>
+ , private ipcdetail::shmem_open_or_create<AllocationAlgorithm>::type
{
/// @cond
typedef ipcdetail::basic_managed_memory_impl
<CharType, AllocationAlgorithm, IndexType,
- ipcdetail::managed_open_or_create_impl
- < shared_memory_object, AllocationAlgorithm::Alignment>::ManagedOpenOrCreateUserOffset> base_t;
- typedef ipcdetail::managed_open_or_create_impl
- <shared_memory_object, AllocationAlgorithm::Alignment> base2_t;
+ ipcdetail::shmem_open_or_create<AllocationAlgorithm>::type::ManagedOpenOrCreateUserOffset> base_t;
+ typedef typename ipcdetail::shmem_open_or_create<AllocationAlgorithm>::type base2_t;
typedef ipcdetail::create_open_func<base_t> create_open_func_t;
@@ -89,7 +95,7 @@
//!Creates shared memory and creates and places the segment manager.
//!This can throw.
- basic_managed_shared_memory(create_only_t create_only, const char *name,
+ basic_managed_shared_memory(create_only_t, const char *name,
size_type size, const void *addr = 0, const permissions& perm = permissions())
: base_t()
, base2_t(create_only, name, size, read_write, addr,
@@ -100,7 +106,7 @@
//!segment was not created. If segment was created it connects to the
//!segment.
//!This can throw.
- basic_managed_shared_memory (open_or_create_t open_or_create,
+ basic_managed_shared_memory (open_or_create_t,
const char *name, size_type size,
const void *addr = 0, const permissions& perm = permissions())
: base_t()
@@ -133,7 +139,7 @@
//!Connects to a created shared memory and its segment manager.
//!This can throw.
- basic_managed_shared_memory (open_only_t open_only, const char* name,
+ basic_managed_shared_memory (open_only_t, const char* name,
const void *addr = 0)
: base_t()
, base2_t(open_only, name, read_write, addr,
Modified: trunk/boost/interprocess/managed_windows_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/managed_windows_shared_memory.hpp (original)
+++ trunk/boost/interprocess/managed_windows_shared_memory.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -32,6 +32,17 @@
namespace boost {
namespace interprocess {
+namespace ipcdetail {
+
+template<class AllocationAlgorithm>
+struct wshmem_open_or_create
+{
+ typedef ipcdetail::managed_open_or_create_impl
+ < windows_shared_memory, AllocationAlgorithm::Alignment, false, false> type;
+};
+
+} //namespace ipcdetail {
+
//!A basic managed windows shared memory creation class. Initializes the
//!shared memory segment. Inherits all basic functionality from
//!basic_managed_memory_impl<CharType, AllocationAlgorithm, IndexType>
@@ -52,18 +63,13 @@
class basic_managed_windows_shared_memory
: public ipcdetail::basic_managed_memory_impl
< CharType, AllocationAlgorithm, IndexType
- , ipcdetail::managed_open_or_create_impl
- < windows_shared_memory
- , AllocationAlgorithm::Alignment
- , false>::ManagedOpenOrCreateUserOffset
- >
+ , ipcdetail::wshmem_open_or_create<AllocationAlgorithm>::type::ManagedOpenOrCreateUserOffset>
{
/// @cond
private:
typedef ipcdetail::basic_managed_memory_impl
<CharType, AllocationAlgorithm, IndexType,
- ipcdetail::managed_open_or_create_impl
- <windows_shared_memory, AllocationAlgorithm::Alignment, false>::ManagedOpenOrCreateUserOffset> base_t;
+ ipcdetail::wshmem_open_or_create<AllocationAlgorithm>::type::ManagedOpenOrCreateUserOffset> base_t;
typedef ipcdetail::create_open_func<base_t> create_open_func_t;
basic_managed_windows_shared_memory *get_this_pointer()
@@ -85,7 +91,7 @@
//!Creates shared memory and creates and places the segment manager.
//!This can throw.
basic_managed_windows_shared_memory
- (create_only_t create_only, const char *name,
+ (create_only_t, const char *name,
size_type size, const void *addr = 0, const permissions &perm = permissions())
: m_wshm(create_only, name, size, read_write, addr,
create_open_func_t(get_this_pointer(), ipcdetail::DoCreate), perm)
@@ -96,7 +102,7 @@
//!segment.
//!This can throw.
basic_managed_windows_shared_memory
- (open_or_create_t open_or_create,
+ (open_or_create_t,
const char *name, size_type size,
const void *addr = 0,
const permissions &perm = permissions())
@@ -108,7 +114,7 @@
//!Connects to a created shared memory and its segment manager.
//!This can throw.
basic_managed_windows_shared_memory
- (open_only_t open_only, const char* name, const void *addr = 0)
+ (open_only_t, const char* name, const void *addr = 0)
: m_wshm(open_only, name, read_write, addr,
create_open_func_t(get_this_pointer(),
ipcdetail::DoOpen))
@@ -181,8 +187,7 @@
}
private:
- ipcdetail::managed_open_or_create_impl< windows_shared_memory
- , AllocationAlgorithm::Alignment, false> m_wshm;
+ typename ipcdetail::wshmem_open_or_create<AllocationAlgorithm>::type m_wshm;
/// @endcond
};
Modified: trunk/boost/interprocess/managed_xsi_shared_memory.hpp
==============================================================================
--- trunk/boost/interprocess/managed_xsi_shared_memory.hpp (original)
+++ trunk/boost/interprocess/managed_xsi_shared_memory.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -36,9 +36,20 @@
namespace interprocess {
+namespace ipcdetail {
+
+template<class AllocationAlgorithm>
+struct xsishmem_open_or_create
+{
+ typedef ipcdetail::managed_open_or_create_impl //!FileBased, StoreDevice
+ < xsi_shared_memory_file_wrapper, AllocationAlgorithm::Alignment, false, true> type;
+};
+
+} //namespace ipcdetail {
+
//!A basic X/Open System Interface (XSI) shared memory named object creation class. Initializes the
//!shared memory segment. Inherits all basic functionality from
-//!basic_managed_memory_impl<CharType, AllocationAlgorithm, IndexType>*/
+//!basic_managed_memory_impl<CharType, AllocationAlgorithm, IndexType>
template
<
class CharType,
@@ -48,19 +59,15 @@
class basic_managed_xsi_shared_memory
: public ipcdetail::basic_managed_memory_impl
<CharType, AllocationAlgorithm, IndexType
- ,ipcdetail::managed_open_or_create_impl
- < xsi_shared_memory_file_wrapper, AllocationAlgorithm::Alignment
- , false, true>::ManagedOpenOrCreateUserOffset>
- , private ipcdetail::managed_open_or_create_impl
- <xsi_shared_memory_file_wrapper, AllocationAlgorithm::Alignment, false, true>
+ ,ipcdetail::xsishmem_open_or_create<AllocationAlgorithm>::type::ManagedOpenOrCreateUserOffset>
+ , private ipcdetail::xsishmem_open_or_create<AllocationAlgorithm>::type
{
/// @cond
public:
typedef xsi_shared_memory_file_wrapper device_type;
public:
- typedef ipcdetail::managed_open_or_create_impl
- <xsi_shared_memory_file_wrapper, AllocationAlgorithm::Alignment, false, true> base2_t;
+ typedef typename ipcdetail::xsishmem_open_or_create<AllocationAlgorithm>::type base2_t;
typedef ipcdetail::basic_managed_memory_impl
<CharType, AllocationAlgorithm, IndexType,
base2_t::ManagedOpenOrCreateUserOffset> base_t;
@@ -94,7 +101,7 @@
//!Creates shared memory and creates and places the segment manager.
//!This can throw.
- basic_managed_xsi_shared_memory(create_only_t create_only, const xsi_key &key,
+ basic_managed_xsi_shared_memory(create_only_t, const xsi_key &key,
std::size_t size, const void *addr = 0, const permissions& perm = permissions())
: base_t()
, base2_t(create_only, key, size, read_write, addr,
@@ -105,7 +112,7 @@
//!segment was not created. If segment was created it connects to the
//!segment.
//!This can throw.
- basic_managed_xsi_shared_memory (open_or_create_t open_or_create,
+ basic_managed_xsi_shared_memory (open_or_create_t,
const xsi_key &key, std::size_t size,
const void *addr = 0, const permissions& perm = permissions())
: base_t()
@@ -127,7 +134,7 @@
//!Connects to a created shared memory and its segment manager.
//!This can throw.
- basic_managed_xsi_shared_memory (open_only_t open_only, const xsi_key &key,
+ basic_managed_xsi_shared_memory (open_only_t, const xsi_key &key,
const void *addr = 0)
: base_t()
, base2_t(open_only, key, read_write, addr,
Modified: trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp (original)
+++ trunk/boost/interprocess/mem_algo/detail/mem_algo_common.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -113,15 +113,15 @@
static size_type multiple_of_units(size_type size)
{ return get_rounded_size(size, Alignment); }
- static multiallocation_chain allocate_many
- (MemoryAlgorithm *memory_algo, size_type elem_bytes, size_type n_elements)
+ static void allocate_many
+ (MemoryAlgorithm *memory_algo, size_type elem_bytes, size_type n_elements, multiallocation_chain &chain)
{
- return this_type::priv_allocate_many(memory_algo, &elem_bytes, n_elements, 0);
+ return this_type::priv_allocate_many(memory_algo, &elem_bytes, n_elements, 0, chain);
}
- static void deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain chain)
+ static void deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain &chain)
{
- return this_type::priv_deallocate_many(memory_algo, boost::move(chain));
+ return this_type::priv_deallocate_many(memory_algo, chain);
}
static bool calculate_lcm_and_needs_backwards_lcmed
@@ -219,13 +219,14 @@
return true;
}
- static multiallocation_chain allocate_many
+ static void allocate_many
( MemoryAlgorithm *memory_algo
, const size_type *elem_sizes
, size_type n_elements
- , size_type sizeof_element)
+ , size_type sizeof_element
+ , multiallocation_chain &chain)
{
- return this_type::priv_allocate_many(memory_algo, elem_sizes, n_elements, sizeof_element);
+ this_type::priv_allocate_many(memory_algo, elem_sizes, n_elements, sizeof_element, chain);
}
static void* allocate_aligned
@@ -448,11 +449,12 @@
}
private:
- static multiallocation_chain priv_allocate_many
+ static void priv_allocate_many
( MemoryAlgorithm *memory_algo
, const size_type *elem_sizes
, size_type n_elements
- , size_type sizeof_element)
+ , size_type sizeof_element
+ , multiallocation_chain &chain)
{
//Note: sizeof_element == 0 indicates that we want to
//allocate n_elements of the same size "*elem_sizes"
@@ -482,7 +484,6 @@
}
}
- multiallocation_chain chain;
if(total_request_units && !multiplication_overflows(total_request_units, Alignment)){
size_type low_idx = 0;
while(low_idx < n_elements){
@@ -568,13 +569,12 @@
}
if(low_idx != n_elements){
- priv_deallocate_many(memory_algo, boost::move(chain));
+ priv_deallocate_many(memory_algo, chain);
}
}
- return boost::move(chain);
}
- static void priv_deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain chain)
+ static void priv_deallocate_many(MemoryAlgorithm *memory_algo, multiallocation_chain &chain)
{
while(!chain.empty()){
memory_algo->priv_deallocate(to_raw_pointer(chain.pop_front()));
Modified: trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp (original)
+++ trunk/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -145,27 +145,25 @@
/// @cond
//!Multiple element allocation, same size
- multiallocation_chain
- allocate_many(size_type elem_bytes, size_type num_elements)
+ void allocate_many(size_type elem_bytes, size_type num_elements, multiallocation_chain &chain)
{
//-----------------------
boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
//-----------------------
- return algo_impl_t::allocate_many(this, elem_bytes, num_elements);
+ algo_impl_t::allocate_many(this, elem_bytes, num_elements, chain);
}
//!Multiple element allocation, different size
- multiallocation_chain
- allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element)
+ void allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain)
{
//-----------------------
boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
//-----------------------
- return algo_impl_t::allocate_many(this, elem_sizes, n_elements, sizeof_element);
+ algo_impl_t::allocate_many(this, elem_sizes, n_elements, sizeof_element, chain);
}
//!Multiple element deallocation
- void deallocate_many(multiallocation_chain chain);
+ void deallocate_many(multiallocation_chain &chain);
/// @endcond
@@ -331,11 +329,11 @@
template<class MutexFamily, class VoidPointer>
inline simple_seq_fit_impl<MutexFamily, VoidPointer>::
- simple_seq_fit_impl(size_type size, size_type extra_hdr_bytes)
+ simple_seq_fit_impl(size_type segment_size, size_type extra_hdr_bytes)
{
//Initialize sizes and counters
m_header.m_allocated = 0;
- m_header.m_size = size;
+ m_header.m_size = segment_size;
m_header.m_extra_hdr_bytes = extra_hdr_bytes;
//Initialize pointers
@@ -344,7 +342,7 @@
m_header.m_root.m_next = reinterpret_cast<block_ctrl*>
((reinterpret_cast<char*>(this) + block1_off));
algo_impl_t::assert_alignment(ipcdetail::to_raw_pointer(m_header.m_root.m_next));
- m_header.m_root.m_next->m_size = (size - block1_off)/Alignment;
+ m_header.m_root.m_next->m_size = (segment_size - block1_off)/Alignment;
m_header.m_root.m_next->m_next = &m_header.m_root;
}
@@ -462,16 +460,16 @@
}
template<class MutexFamily, class VoidPointer>
-inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_add_segment(void *addr, size_type size)
+inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::priv_add_segment(void *addr, size_type segment_size)
{
algo_impl_t::assert_alignment(addr);
//Check size
- BOOST_ASSERT(!(size < MinBlockSize));
- if(size < MinBlockSize)
+ BOOST_ASSERT(!(segment_size < MinBlockSize));
+ if(segment_size < MinBlockSize)
return;
//Construct big block using the new segment
block_ctrl *new_block = static_cast<block_ctrl *>(addr);
- new_block->m_size = size/Alignment;
+ new_block->m_size = segment_size/Alignment;
new_block->m_next = 0;
//Simulate this block was previously allocated
m_header.m_allocated += new_block->m_size*Alignment;
@@ -653,8 +651,7 @@
template<class MutexFamily, class VoidPointer>
inline typename simple_seq_fit_impl<MutexFamily, VoidPointer>::size_type
-simple_seq_fit_impl<MutexFamily, VoidPointer>::
- size(const void *ptr) const
+simple_seq_fit_impl<MutexFamily, VoidPointer>::size(const void *ptr) const
{
//We need no synchronization since this block is not going
//to be modified
@@ -744,7 +741,7 @@
template<class MutexFamily, class VoidPointer>
inline void simple_seq_fit_impl<MutexFamily, VoidPointer>::
- deallocate_many(typename simple_seq_fit_impl<MutexFamily, VoidPointer>::multiallocation_chain chain)
+ deallocate_many(typename simple_seq_fit_impl<MutexFamily, VoidPointer>::multiallocation_chain &chain)
{
//-----------------------
boost::interprocess::scoped_lock<interprocess_mutex> guard(m_header);
Modified: trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp (original)
+++ trunk/boost/interprocess/mem_algo/rbtree_best_fit.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -183,27 +183,25 @@
//Experimental. Dont' use
//!Multiple element allocation, same size
- multiallocation_chain allocate_many(size_type elem_bytes, size_type num_elements)
+ void allocate_many(size_type elem_bytes, size_type num_elements, multiallocation_chain &chain)
{
-
//-----------------------
boost::interprocess::scoped_lock<mutex_type> guard(m_header);
//-----------------------
- return algo_impl_t::allocate_many(this, elem_bytes, num_elements);
+ algo_impl_t::allocate_many(this, elem_bytes, num_elements, chain);
}
//!Multiple element allocation, different size
- multiallocation_chain allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element)
+ void allocate_many(const size_type *elem_sizes, size_type n_elements, size_type sizeof_element, multiallocation_chain &chain)
{
-
//-----------------------
boost::interprocess::scoped_lock<mutex_type> guard(m_header);
//-----------------------
- return algo_impl_t::allocate_many(this, elem_sizes, n_elements, sizeof_element);
+ algo_impl_t::allocate_many(this, elem_sizes, n_elements, sizeof_element, chain);
}
//!Multiple element allocation, different size
- void deallocate_many(multiallocation_chain chain);
+ void deallocate_many(multiallocation_chain &chain);
/// @endcond
@@ -384,16 +382,16 @@
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- priv_add_segment(void *addr, size_type size)
+ priv_add_segment(void *addr, size_type segment_size)
{
//Check alignment
algo_impl_t::check_alignment(addr);
//Check size
- BOOST_ASSERT(size >= (BlockCtrlBytes + EndCtrlBlockBytes));
+ BOOST_ASSERT(segment_size >= (BlockCtrlBytes + EndCtrlBlockBytes));
//Initialize the first big block and the "end" node
block_ctrl *first_big_block = new(addr)block_ctrl;
- first_big_block->m_size = size/Alignment - EndCtrlBlockUnits;
+ first_big_block->m_size = segment_size/Alignment - EndCtrlBlockUnits;
BOOST_ASSERT(first_big_block->m_size >= BlockCtrlUnits);
//The "end" node is just a node of size 0 with the "end" bit set
@@ -450,18 +448,18 @@
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
inline rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- rbtree_best_fit(size_type size, size_type extra_hdr_bytes)
+ rbtree_best_fit(size_type segment_size, size_type extra_hdr_bytes)
{
//Initialize the header
m_header.m_allocated = 0;
- m_header.m_size = size;
+ m_header.m_size = segment_size;
m_header.m_extra_hdr_bytes = extra_hdr_bytes;
//Now write calculate the offset of the first big block that will
//cover the whole segment
- BOOST_ASSERT(get_min_size(extra_hdr_bytes) <= size);
+ BOOST_ASSERT(get_min_size(extra_hdr_bytes) <= segment_size);
size_type block1_off = priv_first_block_offset_from_this(this, extra_hdr_bytes);
- priv_add_segment(reinterpret_cast<char*>(this) + block1_off, size - block1_off);
+ priv_add_segment(reinterpret_cast<char*>(this) + block1_off, segment_size - block1_off);
}
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
@@ -929,12 +927,12 @@
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
inline void rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::
- deallocate_many(typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::multiallocation_chain chain)
+ deallocate_many(typename rbtree_best_fit<MutexFamily, VoidPointer, MemAlignment>::multiallocation_chain &chain)
{
//-----------------------
boost::interprocess::scoped_lock<mutex_type> guard(m_header);
//-----------------------
- algo_impl_t::deallocate_many(this, boost::move(chain));
+ algo_impl_t::deallocate_many(this, chain);
}
template<class MutexFamily, class VoidPointer, std::size_t MemAlignment>
Modified: trunk/boost/interprocess/mem_algo/simple_seq_fit.hpp
==============================================================================
--- trunk/boost/interprocess/mem_algo/simple_seq_fit.hpp (original)
+++ trunk/boost/interprocess/mem_algo/simple_seq_fit.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -44,8 +44,8 @@
//!Constructor. "size" is the total size of the managed memory segment,
//!"extra_hdr_bytes" indicates the extra bytes beginning in the sizeof(simple_seq_fit)
//!offset that the allocator should not use at all.*/
- simple_seq_fit (size_type size, size_type extra_hdr_bytes)
- : base_t(size, extra_hdr_bytes){}
+ simple_seq_fit(size_type segment_size, size_type extra_hdr_bytes)
+ : base_t(segment_size, extra_hdr_bytes){}
};
} //namespace interprocess {
Modified: trunk/boost/interprocess/segment_manager.hpp
==============================================================================
--- trunk/boost/interprocess/segment_manager.hpp (original)
+++ trunk/boost/interprocess/segment_manager.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -94,8 +94,8 @@
//!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)));
}
@@ -123,42 +123,43 @@
/// @cond
//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)
- {
- multiallocation_chain mem(MemoryAlgorithm::allocate_many(elem_bytes, num_elements));
- if(mem.empty()) throw bad_alloc();
- return boost::move(mem);
+ //!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)
+ {
+ 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)
- {
- multiallocation_chain mem(MemoryAlgorithm::allocate_many(element_lenghts, n_elements, sizeof_element));
- if(mem.empty()) throw bad_alloc();
- return boost::move(mem);
+ //!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)
+ {
+ 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); }
-
- //!Deallocates elements pointed by the
- //!multiallocation iterator range.
- void deallocate_many(multiallocation_chain chain)
- { MemoryAlgorithm::deallocate_many(boost::move(chain)); }
+ //!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 all elements contained in chain.
+ //!Never throws.
+ void deallocate_many(multiallocation_chain &chain)
+ { MemoryAlgorithm::deallocate_many(chain); }
/// @endcond
@@ -407,8 +408,8 @@
//!"size" is the size of the memory segment where
//!the segment manager is being constructed.
//!Can throw
- explicit segment_manager(size_type size)
- : Base(size, priv_get_reserved_bytes())
+ explicit segment_manager(size_type segment_size)
+ : Base(segment_size, priv_get_reserved_bytes())
, m_header(static_cast<Base*>(get_this_pointer()))
{
(void) anonymous_instance; (void) unique_instance;
@@ -717,16 +718,16 @@
//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
Modified: trunk/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp
==============================================================================
--- trunk/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp (original)
+++ trunk/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -63,7 +63,7 @@
{ if (ptr) priv_deallocate(ptr, alloc_version()); }
};
-
+
template<class A, class D>
class sp_counted_impl_pd
@@ -122,7 +122,7 @@
this_pointer this_ptr (this);
//Do it now!
scoped_ptr< this_type, scoped_ptr_dealloc_functor<this_allocator> >
- deleter(this_ptr, a_copy);
+ deleter_ptr(this_ptr, a_copy);
typedef typename this_allocator::value_type value_type;
ipcdetail::to_raw_pointer(this_ptr)->~value_type();
}
Modified: trunk/boost/interprocess/streams/bufferstream.hpp
==============================================================================
--- trunk/boost/interprocess/streams/bufferstream.hpp (original)
+++ trunk/boost/interprocess/streams/bufferstream.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -74,10 +74,10 @@
//!Constructor. Assigns formatting buffer.
//!Does not throw.
- explicit basic_bufferbuf(CharT *buffer, std::size_t length,
+ explicit basic_bufferbuf(CharT *buf, std::size_t length,
std::ios_base::openmode mode
= std::ios_base::in | std::ios_base::out)
- : base_t(), m_mode(mode), m_buffer(buffer), m_length(length)
+ : base_t(), m_mode(mode), m_buffer(buf), m_length(length)
{ this->set_pointers(); }
virtual ~basic_bufferbuf(){}
@@ -90,8 +90,8 @@
//!Sets the underlying buffer to a new value
//!Does not throw.
- void buffer(CharT *buffer, std::size_t length)
- { m_buffer = buffer; m_length = length; this->set_pointers(); }
+ void buffer(CharT *buf, std::size_t length)
+ { m_buffer = buf; m_length = length; this->set_pointers(); }
/// @cond
private:
@@ -275,10 +275,10 @@
//!Constructor. Assigns formatting buffer.
//!Does not throw.
- basic_ibufferstream(const CharT *buffer, std::size_t length,
- std::ios_base::openmode mode = std::ios_base::in)
+ basic_ibufferstream(const CharT *buf, std::size_t length,
+ std::ios_base::openmode mode = std::ios_base::in)
: basic_ios_t(), base_t(0),
- m_buf(const_cast<CharT*>(buffer), length, mode | std::ios_base::in)
+ m_buf(const_cast<CharT*>(buf), length, mode | std::ios_base::in)
{ basic_ios_t::init(&m_buf); }
~basic_ibufferstream(){};
@@ -296,8 +296,8 @@
//!Sets the underlying buffer to a new value. Resets
//!stream position. Does not throw.
- void buffer(const CharT *buffer, std::size_t length)
- { m_buf.buffer(const_cast<CharT*>(buffer), length); }
+ void buffer(const CharT *buf, std::size_t length)
+ { m_buf.buffer(const_cast<CharT*>(buf), length); }
/// @cond
private:
@@ -333,10 +333,10 @@
//!Constructor. Assigns formatting buffer.
//!Does not throw.
- basic_obufferstream(CharT *buffer, std::size_t length,
+ basic_obufferstream(CharT *buf, std::size_t length,
std::ios_base::openmode mode = std::ios_base::out)
: basic_ios_t(), base_t(0),
- m_buf(buffer, length, mode | std::ios_base::out)
+ m_buf(buf, length, mode | std::ios_base::out)
{ basic_ios_t::init(&m_buf); }
~basic_obufferstream(){}
@@ -354,8 +354,8 @@
//!Sets the underlying buffer to a new value. Resets
//!stream position. Does not throw.
- void buffer(CharT *buffer, std::size_t length)
- { m_buf.buffer(buffer, length); }
+ void buffer(CharT *buf, std::size_t length)
+ { m_buf.buffer(buf, length); }
/// @cond
private:
@@ -395,10 +395,10 @@
//!Constructor. Assigns formatting buffer.
//!Does not throw.
- basic_bufferstream(CharT *buffer, std::size_t length,
+ basic_bufferstream(CharT *buf, std::size_t length,
std::ios_base::openmode mode
= std::ios_base::in | std::ios_base::out)
- : basic_ios_t(), base_t(0), m_buf(buffer, length, mode)
+ : basic_ios_t(), base_t(0), m_buf(buf, length, mode)
{ basic_ios_t::init(&m_buf); }
~basic_bufferstream(){}
@@ -416,8 +416,8 @@
//!Sets the underlying buffer to a new value. Resets
//!stream position. Does not throw.
- void buffer(CharT *buffer, std::size_t length)
- { m_buf.buffer(buffer, length); }
+ void buffer(CharT *buf, std::size_t length)
+ { m_buf.buffer(buf, length); }
/// @cond
private:
Modified: trunk/boost/interprocess/sync/interprocess_sharable_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_sharable_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/interprocess_sharable_mutex.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -174,12 +174,12 @@
inline void interprocess_sharable_mutex::lock()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
//The exclusive lock must block in the first gate
//if an exclusive lock has been acquired
while (this->m_ctrl.exclusive_in){
- this->m_first_gate.wait(lock);
+ this->m_first_gate.wait(lck);
}
//Mark that exclusive lock has been acquired
@@ -190,18 +190,18 @@
//Now wait until all readers are gone
while (this->m_ctrl.num_shared){
- this->m_second_gate.wait(lock);
+ this->m_second_gate.wait(lck);
}
rollback.release();
}
inline bool interprocess_sharable_mutex::try_lock()
{
- scoped_lock_t lock(m_mut, try_to_lock);
+ scoped_lock_t lck(m_mut, try_to_lock);
//If we can't lock or any has there is any exclusive
//or sharable mark return false;
- if(!lock.owns()
+ if(!lck.owns()
|| this->m_ctrl.exclusive_in
|| this->m_ctrl.num_shared){
return false;
@@ -217,13 +217,13 @@
this->lock();
return true;
}
- scoped_lock_t lock(m_mut, abs_time);
- if(!lock.owns()) return false;
+ scoped_lock_t lck(m_mut, abs_time);
+ if(!lck.owns()) return false;
//The exclusive lock must block in the first gate
//if an exclusive lock has been acquired
while (this->m_ctrl.exclusive_in){
- if(!this->m_first_gate.timed_wait(lock, abs_time)){
+ if(!this->m_first_gate.timed_wait(lck, abs_time)){
if(this->m_ctrl.exclusive_in){
return false;
}
@@ -239,7 +239,7 @@
//Now wait until all readers are gone
while (this->m_ctrl.num_shared){
- if(!this->m_second_gate.timed_wait(lock, abs_time)){
+ if(!this->m_second_gate.timed_wait(lck, abs_time)){
if(this->m_ctrl.num_shared){
return false;
}
@@ -252,7 +252,7 @@
inline void interprocess_sharable_mutex::unlock()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
this->m_ctrl.exclusive_in = 0;
this->m_first_gate.notify_all();
}
@@ -261,14 +261,14 @@
inline void interprocess_sharable_mutex::lock_sharable()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
//The sharable lock must block in the first gate
//if an exclusive lock has been acquired
//or there are too many sharable locks
while(this->m_ctrl.exclusive_in
|| this->m_ctrl.num_shared == constants::max_readers){
- this->m_first_gate.wait(lock);
+ this->m_first_gate.wait(lck);
}
//Increment sharable count
@@ -277,12 +277,12 @@
inline bool interprocess_sharable_mutex::try_lock_sharable()
{
- scoped_lock_t lock(m_mut, try_to_lock);
+ scoped_lock_t lck(m_mut, try_to_lock);
//The sharable lock must fail
//if an exclusive lock has been acquired
//or there are too many sharable locks
- if(!lock.owns()
+ if(!lck.owns()
|| this->m_ctrl.exclusive_in
|| this->m_ctrl.num_shared == constants::max_readers){
return false;
@@ -300,15 +300,15 @@
this->lock_sharable();
return true;
}
- scoped_lock_t lock(m_mut, abs_time);
- if(!lock.owns()) return false;
+ scoped_lock_t lck(m_mut, abs_time);
+ if(!lck.owns()) return false;
//The sharable lock must block in the first gate
//if an exclusive lock has been acquired
//or there are too many sharable locks
while (this->m_ctrl.exclusive_in
|| this->m_ctrl.num_shared == constants::max_readers){
- if(!this->m_first_gate.timed_wait(lock, abs_time)){
+ if(!this->m_first_gate.timed_wait(lck, abs_time)){
if(this->m_ctrl.exclusive_in
|| this->m_ctrl.num_shared == constants::max_readers){
return false;
@@ -324,7 +324,7 @@
inline void interprocess_sharable_mutex::unlock_sharable()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
//Decrement sharable count
--this->m_ctrl.num_shared;
if (this->m_ctrl.num_shared == 0){
Modified: trunk/boost/interprocess/sync/interprocess_upgradable_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/interprocess_upgradable_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/interprocess_upgradable_mutex.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -286,12 +286,12 @@
inline void interprocess_upgradable_mutex::lock()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
//The exclusive lock must block in the first gate
//if an exclusive or upgradable lock has been acquired
while (this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in){
- this->m_first_gate.wait(lock);
+ this->m_first_gate.wait(lck);
}
//Mark that exclusive lock has been acquired
@@ -302,18 +302,18 @@
//Now wait until all readers are gone
while (this->m_ctrl.num_upr_shar){
- this->m_second_gate.wait(lock);
+ this->m_second_gate.wait(lck);
}
rollback.release();
}
inline bool interprocess_upgradable_mutex::try_lock()
{
- scoped_lock_t lock(m_mut, try_to_lock);
+ scoped_lock_t lck(m_mut, try_to_lock);
//If we can't lock or any has there is any exclusive, upgradable
//or sharable mark return false;
- if(!lock.owns()
+ if(!lck.owns()
|| this->m_ctrl.exclusive_in
|| this->m_ctrl.num_upr_shar){
return false;
@@ -329,13 +329,13 @@
this->lock();
return true;
}
- scoped_lock_t lock(m_mut, abs_time);
- if(!lock.owns()) return false;
+ scoped_lock_t lck(m_mut, abs_time);
+ if(!lck.owns()) return false;
//The exclusive lock must block in the first gate
//if an exclusive or upgradable lock has been acquired
while (this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in){
- if(!this->m_first_gate.timed_wait(lock, abs_time)){
+ if(!this->m_first_gate.timed_wait(lck, abs_time)){
if(this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in){
return false;
}
@@ -351,7 +351,7 @@
//Now wait until all readers are gone
while (this->m_ctrl.num_upr_shar){
- if(!this->m_second_gate.timed_wait(lock, abs_time)){
+ if(!this->m_second_gate.timed_wait(lck, abs_time)){
if(this->m_ctrl.num_upr_shar){
return false;
}
@@ -364,7 +364,7 @@
inline void interprocess_upgradable_mutex::unlock()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
this->m_ctrl.exclusive_in = 0;
this->m_first_gate.notify_all();
}
@@ -373,14 +373,14 @@
inline void interprocess_upgradable_mutex::lock_upgradable()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
//The upgradable lock must block in the first gate
//if an exclusive or upgradable lock has been acquired
//or there are too many sharable locks
while(this->m_ctrl.exclusive_in || this->m_ctrl.upgradable_in
|| this->m_ctrl.num_upr_shar == constants::max_readers){
- this->m_first_gate.wait(lock);
+ this->m_first_gate.wait(lck);
}
//Mark that upgradable lock has been acquired
@@ -391,12 +391,12 @@
inline bool interprocess_upgradable_mutex::try_lock_upgradable()
{
- scoped_lock_t lock(m_mut, try_to_lock);
+ scoped_lock_t lck(m_mut, try_to_lock);
//The upgradable lock must fail
//if an exclusive or upgradable lock has been acquired
//or there are too many sharable locks
- if(!lock.owns()
+ if(!lck.owns()
|| this->m_ctrl.exclusive_in
|| this->m_ctrl.upgradable_in
|| this->m_ctrl.num_upr_shar == constants::max_readers){
@@ -417,8 +417,8 @@
this->lock_upgradable();
return true;
}
- scoped_lock_t lock(m_mut, abs_time);
- if(!lock.owns()) return false;
+ scoped_lock_t lck(m_mut, abs_time);
+ if(!lck.owns()) return false;
//The upgradable lock must block in the first gate
//if an exclusive or upgradable lock has been acquired
@@ -426,7 +426,7 @@
while(this->m_ctrl.exclusive_in
|| this->m_ctrl.upgradable_in
|| this->m_ctrl.num_upr_shar == constants::max_readers){
- if(!this->m_first_gate.timed_wait(lock, abs_time)){
+ if(!this->m_first_gate.timed_wait(lck, abs_time)){
if((this->m_ctrl.exclusive_in
|| this->m_ctrl.upgradable_in
|| this->m_ctrl.num_upr_shar == constants::max_readers)){
@@ -445,7 +445,7 @@
inline void interprocess_upgradable_mutex::unlock_upgradable()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
//Mark that upgradable lock has been acquired
//And add upgradable to the sharable count
this->m_ctrl.upgradable_in = 0;
@@ -457,14 +457,14 @@
inline void interprocess_upgradable_mutex::lock_sharable()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
//The sharable lock must block in the first gate
//if an exclusive lock has been acquired
//or there are too many sharable locks
while(this->m_ctrl.exclusive_in
|| this->m_ctrl.num_upr_shar == constants::max_readers){
- this->m_first_gate.wait(lock);
+ this->m_first_gate.wait(lck);
}
//Increment sharable count
@@ -473,12 +473,12 @@
inline bool interprocess_upgradable_mutex::try_lock_sharable()
{
- scoped_lock_t lock(m_mut, try_to_lock);
+ scoped_lock_t lck(m_mut, try_to_lock);
//The sharable lock must fail
//if an exclusive lock has been acquired
//or there are too many sharable locks
- if(!lock.owns()
+ if(!lck.owns()
|| this->m_ctrl.exclusive_in
|| this->m_ctrl.num_upr_shar == constants::max_readers){
return false;
@@ -496,15 +496,15 @@
this->lock_sharable();
return true;
}
- scoped_lock_t lock(m_mut, abs_time);
- if(!lock.owns()) return false;
+ scoped_lock_t lck(m_mut, abs_time);
+ if(!lck.owns()) return false;
//The sharable lock must block in the first gate
//if an exclusive lock has been acquired
//or there are too many sharable locks
while (this->m_ctrl.exclusive_in
|| this->m_ctrl.num_upr_shar == constants::max_readers){
- if(!this->m_first_gate.timed_wait(lock, abs_time)){
+ if(!this->m_first_gate.timed_wait(lck, abs_time)){
if(this->m_ctrl.exclusive_in
|| this->m_ctrl.num_upr_shar == constants::max_readers){
return false;
@@ -520,7 +520,7 @@
inline void interprocess_upgradable_mutex::unlock_sharable()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
//Decrement sharable count
--this->m_ctrl.num_upr_shar;
if (this->m_ctrl.num_upr_shar == 0){
@@ -537,7 +537,7 @@
inline void interprocess_upgradable_mutex::unlock_and_lock_upgradable()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
//Unmark it as exclusive
this->m_ctrl.exclusive_in = 0;
//Mark it as upgradable
@@ -550,7 +550,7 @@
inline void interprocess_upgradable_mutex::unlock_and_lock_sharable()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
//Unmark it as exclusive
this->m_ctrl.exclusive_in = 0;
//The sharable count should be 0 so increment it
@@ -561,7 +561,7 @@
inline void interprocess_upgradable_mutex::unlock_upgradable_and_lock_sharable()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
//Unmark it as upgradable (we don't have to decrement count)
this->m_ctrl.upgradable_in = 0;
//Notify readers/upgradable that they can enter
@@ -572,7 +572,7 @@
inline void interprocess_upgradable_mutex::unlock_upgradable_and_lock()
{
- scoped_lock_t lock(m_mut);
+ scoped_lock_t lck(m_mut);
//Simulate unlock_upgradable() without
//notifying sharables.
this->m_ctrl.upgradable_in = 0;
@@ -584,16 +584,16 @@
upgradable_to_exclusive_rollback rollback(m_ctrl);
while (this->m_ctrl.num_upr_shar){
- this->m_second_gate.wait(lock);
+ this->m_second_gate.wait(lck);
}
rollback.release();
}
inline bool interprocess_upgradable_mutex::try_unlock_upgradable_and_lock()
{
- scoped_lock_t lock(m_mut, try_to_lock);
+ scoped_lock_t lck(m_mut, try_to_lock);
//Check if there are no readers
- if(!lock.owns()
+ if(!lck.owns()
|| this->m_ctrl.num_upr_shar != 1){
return false;
}
@@ -611,8 +611,8 @@
this->unlock_upgradable_and_lock();
return true;
}
- scoped_lock_t lock(m_mut, abs_time);
- if(!lock.owns()) return false;
+ scoped_lock_t lck(m_mut, abs_time);
+ if(!lck.owns()) return false;
//Simulate unlock_upgradable() without
//notifying sharables.
@@ -625,7 +625,7 @@
upgradable_to_exclusive_rollback rollback(m_ctrl);
while (this->m_ctrl.num_upr_shar){
- if(!this->m_second_gate.timed_wait(lock, abs_time)){
+ if(!this->m_second_gate.timed_wait(lck, abs_time)){
if(this->m_ctrl.num_upr_shar){
return false;
}
@@ -638,11 +638,11 @@
inline bool interprocess_upgradable_mutex::try_unlock_sharable_and_lock()
{
- scoped_lock_t lock(m_mut, try_to_lock);
+ scoped_lock_t lck(m_mut, try_to_lock);
//If we can't lock or any has there is any exclusive, upgradable
//or sharable mark return false;
- if(!lock.owns()
+ if(!lck.owns()
|| this->m_ctrl.exclusive_in
|| this->m_ctrl.upgradable_in
|| this->m_ctrl.num_upr_shar != 1){
@@ -655,11 +655,11 @@
inline bool interprocess_upgradable_mutex::try_unlock_sharable_and_lock_upgradable()
{
- scoped_lock_t lock(m_mut, try_to_lock);
+ scoped_lock_t lck(m_mut, try_to_lock);
//The upgradable lock must fail
//if an exclusive or upgradable lock has been acquired
- if(!lock.owns()
+ if(!lck.owns()
|| this->m_ctrl.exclusive_in
|| this->m_ctrl.upgradable_in){
return false;
Modified: trunk/boost/interprocess/sync/named_sharable_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/named_sharable_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/named_sharable_mutex.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -144,7 +144,8 @@
interprocess_sharable_mutex *mutex() const
{ return static_cast<interprocess_sharable_mutex*>(m_shmem.get_user_address()); }
- ipcdetail::managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t;
+ open_create_impl_t m_shmem;
typedef ipcdetail::named_creation_functor<interprocess_sharable_mutex> construct_func_t;
/// @endcond
};
@@ -159,8 +160,7 @@
: m_shmem (create_only
,name
,sizeof(interprocess_sharable_mutex) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(ipcdetail::DoCreate)
@@ -172,8 +172,7 @@
: m_shmem (open_or_create
,name
,sizeof(interprocess_sharable_mutex) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(ipcdetail::DoOpenOrCreate)
Modified: trunk/boost/interprocess/sync/named_upgradable_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/named_upgradable_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/named_upgradable_mutex.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -235,7 +235,8 @@
interprocess_upgradable_mutex *mutex() const
{ return static_cast<interprocess_upgradable_mutex*>(m_shmem.get_user_address()); }
- ipcdetail::managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t;
+ open_create_impl_t m_shmem;
typedef ipcdetail::named_creation_functor<interprocess_upgradable_mutex> construct_func_t;
/// @endcond
};
@@ -250,8 +251,7 @@
: m_shmem (create_only
,name
,sizeof(interprocess_upgradable_mutex) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(ipcdetail::DoCreate)
@@ -263,8 +263,7 @@
: m_shmem (open_or_create
,name
,sizeof(interprocess_upgradable_mutex) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(ipcdetail::DoOpenOrCreate)
Modified: trunk/boost/interprocess/sync/shm/named_condition.hpp
==============================================================================
--- trunk/boost/interprocess/sync/shm/named_condition.hpp (original)
+++ trunk/boost/interprocess/sync/shm/named_condition.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -150,7 +150,8 @@
friend class boost::interprocess::ipcdetail::interprocess_tester;
void dont_close_on_destruction();
- managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t;
+ open_create_impl_t m_shmem;
template <class T, class Arg> friend class boost::interprocess::ipcdetail::named_creation_functor;
typedef boost::interprocess::ipcdetail::named_creation_functor<internal_condition> construct_func_t;
@@ -166,8 +167,7 @@
: m_shmem (create_only
,name
,sizeof(internal_condition) +
- managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoCreate)
@@ -178,8 +178,7 @@
: m_shmem (open_or_create
,name
,sizeof(internal_condition) +
- managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoOpenOrCreate)
Modified: trunk/boost/interprocess/sync/shm/named_condition_any.hpp
==============================================================================
--- trunk/boost/interprocess/sync/shm/named_condition_any.hpp (original)
+++ trunk/boost/interprocess/sync/shm/named_condition_any.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -61,8 +61,7 @@
: m_shmem (create_only
,name
,sizeof(internal_condition) +
- managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoCreate)
@@ -79,8 +78,7 @@
: m_shmem (open_or_create
,name
,sizeof(internal_condition) +
- managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoOpenOrCreate)
@@ -176,7 +174,8 @@
void dont_close_on_destruction()
{ interprocess_tester::dont_close_on_destruction(m_shmem); }
- managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t;
+ open_create_impl_t m_shmem;
template <class T, class Arg> friend class boost::interprocess::ipcdetail::named_creation_functor;
typedef boost::interprocess::ipcdetail::named_creation_functor<internal_condition> construct_func_t;
Modified: trunk/boost/interprocess/sync/shm/named_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/shm/named_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/shm/named_mutex.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -107,8 +107,8 @@
private:
friend class ipcdetail::interprocess_tester;
void dont_close_on_destruction();
-
- ipcdetail::managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t;
+ open_create_impl_t m_shmem;
typedef ipcdetail::named_creation_functor<interprocess_mutex> construct_func_t;
/// @endcond
};
@@ -125,8 +125,7 @@
: m_shmem (create_only
,name
,sizeof(interprocess_mutex) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(ipcdetail::DoCreate)
@@ -137,8 +136,7 @@
: m_shmem (open_or_create
,name
,sizeof(interprocess_mutex) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(ipcdetail::DoOpenOrCreate)
Modified: trunk/boost/interprocess/sync/shm/named_recursive_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/shm/named_recursive_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/shm/named_recursive_mutex.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -101,8 +101,8 @@
interprocess_recursive_mutex *mutex() const
{ return static_cast<interprocess_recursive_mutex*>(m_shmem.get_user_address()); }
-
- managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t;
+ open_create_impl_t m_shmem;
typedef named_creation_functor<interprocess_recursive_mutex> construct_func_t;
/// @endcond
};
@@ -117,8 +117,7 @@
: m_shmem (create_only
,name
,sizeof(interprocess_recursive_mutex) +
- managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoCreate)
@@ -129,8 +128,7 @@
: m_shmem (open_or_create
,name
,sizeof(interprocess_recursive_mutex) +
- managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoOpenOrCreate)
Modified: trunk/boost/interprocess/sync/shm/named_semaphore.hpp
==============================================================================
--- trunk/boost/interprocess/sync/shm/named_semaphore.hpp (original)
+++ trunk/boost/interprocess/sync/shm/named_semaphore.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -65,7 +65,8 @@
interprocess_semaphore *semaphore() const
{ return static_cast<interprocess_semaphore*>(m_shmem.get_user_address()); }
- managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t;
+ open_create_impl_t m_shmem;
typedef named_creation_functor<interprocess_semaphore, int> construct_func_t;
/// @endcond
};
@@ -81,8 +82,7 @@
: m_shmem (create_only
,name
,sizeof(interprocess_semaphore) +
- managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoCreate, initialCount)
@@ -94,8 +94,7 @@
: m_shmem (open_or_create
,name
,sizeof(interprocess_semaphore) +
- managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(DoOpenOrCreate, initialCount)
Modified: trunk/boost/interprocess/sync/shm/named_upgradable_mutex.hpp
==============================================================================
--- trunk/boost/interprocess/sync/shm/named_upgradable_mutex.hpp (original)
+++ trunk/boost/interprocess/sync/shm/named_upgradable_mutex.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -229,7 +229,8 @@
interprocess_upgradable_mutex *mutex() const
{ return static_cast<interprocess_upgradable_mutex*>(m_shmem.get_user_address()); }
- ipcdetail::managed_open_or_create_impl<shared_memory_object> m_shmem;
+ typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> open_create_impl_t;
+ open_create_impl_t m_shmem;
typedef ipcdetail::named_creation_functor<interprocess_upgradable_mutex> construct_func_t;
/// @endcond
};
@@ -244,8 +245,7 @@
: m_shmem (create_only
,name
,sizeof(interprocess_upgradable_mutex) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(ipcdetail::DoCreate)
@@ -257,8 +257,7 @@
: m_shmem (open_or_create
,name
,sizeof(interprocess_upgradable_mutex) +
- ipcdetail::managed_open_or_create_impl<shared_memory_object>::
- ManagedOpenOrCreateUserOffset
+ open_create_impl_t::ManagedOpenOrCreateUserOffset
,read_write
,0
,construct_func_t(ipcdetail::DoOpenOrCreate)
Modified: trunk/boost/interprocess/sync/windows/sync_utils.hpp
==============================================================================
--- trunk/boost/interprocess/sync/windows/sync_utils.hpp (original)
+++ trunk/boost/interprocess/sync/windows/sync_utils.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -23,7 +23,13 @@
#include <boost/interprocess/sync/scoped_lock.hpp>
#include <boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp>
#include <boost/interprocess/sync/windows/winapi_mutex_wrapper.hpp>
-#include <boost/unordered/unordered_map.hpp>
+
+//Shield against external warnings
+#include <boost/interprocess/detail/config_external_begin.hpp>
+ #include <boost/unordered/unordered_map.hpp>
+#include <boost/interprocess/detail/config_external_end.hpp>
+
+
#include <boost/container/map.hpp>
#include <cstddef>
@@ -71,7 +77,7 @@
internal_type &internal_pod()
{ return rand_; }
- const void *map_addr() const
+ const void *map_address() const
{ return map_addr_; }
friend std::size_t hash_value(const sync_id &m)
@@ -94,7 +100,7 @@
struct address_less
{
bool operator()(sync_id const * const l, sync_id const * const r) const
- { return l->map_addr() < r->map_addr(); }
+ { return l->map_address() < r->map_address(); }
};
typedef boost::unordered_map<sync_id, void*> umap_type;
@@ -156,9 +162,9 @@
umap_type::value_type v(id, (void*)0);
scoped_lock<spin_mutex> lock(mtx_);
umap_type::iterator it = umap_.insert(v).first;
- map_[&it->first] = it;
void *&hnd_val = it->second;
if(!hnd_val){
+ map_[&it->first] = it;
hnd_val = open_or_create_mutex(id);
if(popen_created) *popen_created = true;
}
@@ -170,9 +176,9 @@
umap_type::value_type v(id, (void*)0);
scoped_lock<spin_mutex> lock(mtx_);
umap_type::iterator it = umap_.insert(v).first;
- map_[&it->first] = it;
void *&hnd_val = it->second;
if(!hnd_val){
+ map_[&it->first] = it;
hnd_val = open_or_create_semaphore(id, initial_count);
if(popen_created) *popen_created = true;
}
@@ -195,13 +201,13 @@
void destroy_syncs_in_range(const void *addr, std::size_t size)
{
- sync_id low_id(addr);
- sync_id hig_id(static_cast<const char*>(addr)+size);
+ const sync_id low_id(addr);
+ const sync_id hig_id(static_cast<const char*>(addr)+size);
scoped_lock<spin_mutex> lock(mtx_);
map_type::iterator itlow(map_.lower_bound(&low_id)),
ithig(map_.lower_bound(&hig_id));
while(itlow != ithig){
- void *hnd = umap_[*itlow->first];
+ void * const hnd = umap_[*itlow->first];
winapi::close_handle(hnd);
umap_.erase(*itlow->first);
itlow = map_.erase(itlow);
Modified: trunk/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp
==============================================================================
--- trunk/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp (original)
+++ trunk/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp 2012-11-24 16:11:54 EST (Sat, 24 Nov 2012)
@@ -95,18 +95,18 @@
long value() const
{
- long count, limit;
- if(!winapi::get_semaphore_info(m_sem_hnd, count, limit))
+ long l_count, l_limit;
+ if(!winapi::get_semaphore_info(m_sem_hnd, l_count, l_limit))
return 0;
- return count;
+ return l_count;
}
long limit() const
{
- long count, limit;
- if(!winapi::get_semaphore_info(m_sem_hnd, count, limit))
+ long l_count, l_limit;
+ if(!winapi::get_semaphore_info(m_sem_hnd, l_count, l_limit))
return 0;
- return limit;
+ return l_limit;
}
/// @cond
@@ -136,7 +136,7 @@
{ this->close(); }
void *release()
- {
+ {
void *hnd = m_sem_hnd;
m_sem_hnd = winapi::invalid_handle_value;
return hnd;
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk