|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81664 - in branches/release: boost/interprocess boost/interprocess/allocators boost/interprocess/allocators/detail boost/interprocess/detail boost/interprocess/ipc boost/interprocess/mem_algo boost/interprocess/mem_algo/detail boost/interprocess/smart_ptr/detail boost/interprocess/streams boost/interprocess/sync boost/interprocess/sync/shm boost/interprocess/sync/windows libs/interprocess libs/interprocess/doc libs/interprocess/example libs/interprocess/proj/vc7ide libs/interprocess/test
From: igaztanaga_at_[hidden]
Date: 2012-12-01 18:08:35
Author: igaztanaga
Date: 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
New Revision: 81664
URL: http://svn.boost.org/trac/boost/changeset/81664
Log:
Merged interprocess from trunk
Added:
branches/release/boost/interprocess/detail/config_external_begin.hpp
- copied unchanged from r81663, /trunk/boost/interprocess/detail/config_external_begin.hpp
branches/release/boost/interprocess/detail/config_external_end.hpp
- copied unchanged from r81663, /trunk/boost/interprocess/detail/config_external_end.hpp
Properties modified:
branches/release/boost/interprocess/ (props changed)
branches/release/libs/interprocess/ (props changed)
Text files modified:
branches/release/boost/interprocess/allocators/adaptive_pool.hpp | 10 +-
branches/release/boost/interprocess/allocators/allocator.hpp | 25 ++----
branches/release/boost/interprocess/allocators/cached_adaptive_pool.hpp | 8 +-
branches/release/boost/interprocess/allocators/cached_node_allocator.hpp | 6
branches/release/boost/interprocess/allocators/detail/adaptive_node_pool.hpp | 10 ++
branches/release/boost/interprocess/allocators/detail/allocator_common.hpp | 69 +++++++------------
branches/release/boost/interprocess/allocators/node_allocator.hpp | 10 +-
branches/release/boost/interprocess/allocators/private_adaptive_pool.hpp | 10 +-
branches/release/boost/interprocess/allocators/private_node_allocator.hpp | 10 +-
branches/release/boost/interprocess/detail/managed_global_memory.hpp | 4
branches/release/boost/interprocess/detail/managed_memory_impl.hpp | 44 +++++++-----
branches/release/boost/interprocess/detail/managed_multi_shared_memory.hpp | 2
branches/release/boost/interprocess/detail/managed_open_or_create_impl.hpp | 16 ++--
branches/release/boost/interprocess/detail/portable_intermodule_singleton.hpp | 6
branches/release/boost/interprocess/detail/preprocessor.hpp | 14 +-
branches/release/boost/interprocess/detail/robust_emulation.hpp | 14 +-
branches/release/boost/interprocess/detail/segment_manager_helper.hpp | 26 +++---
branches/release/boost/interprocess/detail/win32_api.hpp | 2
branches/release/boost/interprocess/detail/workaround.hpp | 15 +++
branches/release/boost/interprocess/ipc/message_queue.hpp | 46 ++++++------
branches/release/boost/interprocess/managed_mapped_file.hpp | 28 ++++---
branches/release/boost/interprocess/managed_shared_memory.hpp | 30 +++++---
branches/release/boost/interprocess/managed_windows_shared_memory.hpp | 29 ++++---
branches/release/boost/interprocess/managed_xsi_shared_memory.hpp | 29 +++++---
branches/release/boost/interprocess/mem_algo/detail/mem_algo_common.hpp | 28 +++---
branches/release/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp | 31 +++----
branches/release/boost/interprocess/mem_algo/rbtree_best_fit.hpp | 30 +++----
branches/release/boost/interprocess/mem_algo/simple_seq_fit.hpp | 4
branches/release/boost/interprocess/segment_manager.hpp | 77 ++++++++++----------
branches/release/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp | 4
branches/release/boost/interprocess/streams/bufferstream.hpp | 34 ++++----
branches/release/boost/interprocess/sync/interprocess_sharable_mutex.hpp | 36 +++++-----
branches/release/boost/interprocess/sync/interprocess_upgradable_mutex.hpp | 80 +++++++++++-----------
branches/release/boost/interprocess/sync/named_sharable_mutex.hpp | 9 +-
branches/release/boost/interprocess/sync/named_upgradable_mutex.hpp | 9 +-
branches/release/boost/interprocess/sync/shm/named_condition.hpp | 9 +-
branches/release/boost/interprocess/sync/shm/named_condition_any.hpp | 9 +-
branches/release/boost/interprocess/sync/shm/named_mutex.hpp | 10 +-
branches/release/boost/interprocess/sync/shm/named_recursive_mutex.hpp | 10 +-
branches/release/boost/interprocess/sync/shm/named_semaphore.hpp | 9 +-
branches/release/boost/interprocess/sync/shm/named_upgradable_mutex.hpp | 9 +-
branches/release/boost/interprocess/sync/windows/sync_utils.hpp | 22 +++--
branches/release/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp | 14 +-
branches/release/libs/interprocess/doc/interprocess.qbk | 64 +++++++++--------
branches/release/libs/interprocess/example/comp_doc_anonymous_semaphoreB.cpp | 3
branches/release/libs/interprocess/example/doc_managed_copy_on_write.cpp | 14 ++-
branches/release/libs/interprocess/example/doc_managed_multiple_allocation.cpp | 7 +
branches/release/libs/interprocess/example/doc_multi_index.cpp | 7 +
branches/release/libs/interprocess/example/doc_unordered_map.cpp | 12 +++
branches/release/libs/interprocess/proj/vc7ide/adaptive_node_pool_test.vcproj | 2
branches/release/libs/interprocess/proj/vc7ide/flat_tree_test.vcproj | 2
branches/release/libs/interprocess/proj/vc7ide/interprocesslib.vcproj | 6 +
branches/release/libs/interprocess/proj/vc7ide/list_test.vcproj | 3
branches/release/libs/interprocess/proj/vc7ide/offset_ptr_test.vcproj | 3
branches/release/libs/interprocess/proj/vc7ide/stable_vector_test.vcproj | 2
branches/release/libs/interprocess/proj/vc7ide/vector_test.vcproj | 2
branches/release/libs/interprocess/test/condition_test_template.hpp | 4
branches/release/libs/interprocess/test/deque_test.cpp | 9 +-
branches/release/libs/interprocess/test/expand_bwd_test_allocator.hpp | 7 +
branches/release/libs/interprocess/test/intersegment_ptr_test.cpp | 8 +-
branches/release/libs/interprocess/test/mapped_file_test.cpp | 6
branches/release/libs/interprocess/test/memory_algorithm_test.cpp | 6
branches/release/libs/interprocess/test/memory_algorithm_test_template.hpp | 18 +++-
branches/release/libs/interprocess/test/multi_index_test.cpp | 9 ++
branches/release/libs/interprocess/test/named_allocation_test_template.hpp | 6
branches/release/libs/interprocess/test/offset_ptr_test.cpp | 65 +++++++++++++++++-
branches/release/libs/interprocess/test/set_test.hpp | 142 ++++++++++++++++++++--------------------
branches/release/libs/interprocess/test/shared_memory_test.cpp | 2
branches/release/libs/interprocess/test/unordered_test.cpp | 10 ++
branches/release/libs/interprocess/test/user_buffer_test.cpp | 1
branches/release/libs/interprocess/test/windows_shared_memory_mapping_test.cpp | 4
branches/release/libs/interprocess/test/windows_shared_memory_test.cpp | 2
72 files changed, 728 insertions(+), 595 deletions(-)
Modified: branches/release/boost/interprocess/allocators/adaptive_pool.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/adaptive_pool.hpp (original)
+++ branches/release/boost/interprocess/allocators/adaptive_pool.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/allocators/allocator.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/allocator.hpp (original)
+++ branches/release/boost/interprocess/allocators/allocator.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/allocators/cached_adaptive_pool.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/cached_adaptive_pool.hpp (original)
+++ branches/release/boost/interprocess/allocators/cached_adaptive_pool.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/allocators/cached_node_allocator.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/cached_node_allocator.hpp (original)
+++ branches/release/boost/interprocess/allocators/cached_node_allocator.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/allocators/detail/adaptive_node_pool.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/detail/adaptive_node_pool.hpp (original)
+++ branches/release/boost/interprocess/allocators/detail/adaptive_node_pool.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/allocators/detail/allocator_common.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/detail/allocator_common.hpp (original)
+++ branches/release/boost/interprocess/allocators/detail/allocator_common.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/allocators/node_allocator.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/node_allocator.hpp (original)
+++ branches/release/boost/interprocess/allocators/node_allocator.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/allocators/private_adaptive_pool.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/private_adaptive_pool.hpp (original)
+++ branches/release/boost/interprocess/allocators/private_adaptive_pool.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/allocators/private_node_allocator.hpp
==============================================================================
--- branches/release/boost/interprocess/allocators/private_node_allocator.hpp (original)
+++ branches/release/boost/interprocess/allocators/private_node_allocator.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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
};
Modified: branches/release/boost/interprocess/detail/managed_global_memory.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/managed_global_memory.hpp (original)
+++ branches/release/boost/interprocess/detail/managed_global_memory.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/detail/managed_memory_impl.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/managed_memory_impl.hpp (original)
+++ branches/release/boost/interprocess/detail/managed_memory_impl.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/detail/managed_multi_shared_memory.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/managed_multi_shared_memory.hpp (original)
+++ branches/release/boost/interprocess/detail/managed_multi_shared_memory.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/detail/managed_open_or_create_impl.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/managed_open_or_create_impl.hpp (original)
+++ branches/release/boost/interprocess/detail/managed_open_or_create_impl.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/detail/portable_intermodule_singleton.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/portable_intermodule_singleton.hpp (original)
+++ branches/release/boost/interprocess/detail/portable_intermodule_singleton.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/detail/preprocessor.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/preprocessor.hpp (original)
+++ branches/release/boost/interprocess/detail/preprocessor.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -35,7 +35,7 @@
//This cast is ugly but it is necessary until "perfect forwarding"
//is achieved in C++0x. Meanwhile, if we want to be able to
//bind rvalues with non-const references, we have to be ugly
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_INTERPROCESS_PP_PARAM_LIST(z, n, data) \
BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \
//!
@@ -45,7 +45,7 @@
//!
#endif
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_INTERPROCESS_PP_PARAM(U, u) \
U && u \
//!
@@ -55,20 +55,20 @@
//!
#endif
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \
BOOST_PP_CAT(m_p, n) (::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \
//!
-#else //#ifndef BOOST_NO_RVALUE_REFERENCES
+#else //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_INTERPROCESS_PP_PARAM_INIT(z, n, data) \
BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \
//!
#endif
-#ifndef BOOST_NO_RVALUE_REFERENCES
+#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
@@ -172,7 +172,7 @@
::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \
//!
-#if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
#define BOOST_INTERPROCESS_PP_MEMBER_FORWARD(z, n, data) BOOST_PP_CAT(this->m_p, n).get() \
//!
@@ -192,7 +192,7 @@
//!
-#endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
+#endif //!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
#include <boost/interprocess/detail/config_end.hpp>
Modified: branches/release/boost/interprocess/detail/robust_emulation.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/robust_emulation.hpp (original)
+++ branches/release/boost/interprocess/detail/robust_emulation.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/detail/segment_manager_helper.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/segment_manager_helper.hpp (original)
+++ branches/release/boost/interprocess/detail/segment_manager_helper.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/detail/win32_api.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/win32_api.hpp (original)
+++ branches/release/boost/interprocess/detail/win32_api.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/detail/workaround.hpp
==============================================================================
--- branches/release/boost/interprocess/detail/workaround.hpp (original)
+++ branches/release/boost/interprocess/detail/workaround.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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
@@ -117,7 +117,7 @@
#endif
#endif //!defined(BOOST_INTERPROCESS_WINDOWS)
-#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)
+#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_INTERPROCESS_PERFECT_FORWARDING
#endif
@@ -154,6 +154,17 @@
#define BOOST_INTERPROCESS_NEVER_INLINE __attribute__((__noinline__))
#endif
+#if defined(BOOST_NO_CXX11_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: branches/release/boost/interprocess/ipc/message_queue.hpp
==============================================================================
--- branches/release/boost/interprocess/ipc/message_queue.hpp (original)
+++ branches/release/boost/interprocess/ipc/message_queue.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/managed_mapped_file.hpp
==============================================================================
--- branches/release/boost/interprocess/managed_mapped_file.hpp (original)
+++ branches/release/boost/interprocess/managed_mapped_file.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/managed_shared_memory.hpp
==============================================================================
--- branches/release/boost/interprocess/managed_shared_memory.hpp (original)
+++ branches/release/boost/interprocess/managed_shared_memory.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/managed_windows_shared_memory.hpp
==============================================================================
--- branches/release/boost/interprocess/managed_windows_shared_memory.hpp (original)
+++ branches/release/boost/interprocess/managed_windows_shared_memory.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/managed_xsi_shared_memory.hpp
==============================================================================
--- branches/release/boost/interprocess/managed_xsi_shared_memory.hpp (original)
+++ branches/release/boost/interprocess/managed_xsi_shared_memory.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/mem_algo/detail/mem_algo_common.hpp
==============================================================================
--- branches/release/boost/interprocess/mem_algo/detail/mem_algo_common.hpp (original)
+++ branches/release/boost/interprocess/mem_algo/detail/mem_algo_common.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp
==============================================================================
--- branches/release/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp (original)
+++ branches/release/boost/interprocess/mem_algo/detail/simple_seq_fit_impl.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/mem_algo/rbtree_best_fit.hpp
==============================================================================
--- branches/release/boost/interprocess/mem_algo/rbtree_best_fit.hpp (original)
+++ branches/release/boost/interprocess/mem_algo/rbtree_best_fit.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/mem_algo/simple_seq_fit.hpp
==============================================================================
--- branches/release/boost/interprocess/mem_algo/simple_seq_fit.hpp (original)
+++ branches/release/boost/interprocess/mem_algo/simple_seq_fit.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/segment_manager.hpp
==============================================================================
--- branches/release/boost/interprocess/segment_manager.hpp (original)
+++ branches/release/boost/interprocess/segment_manager.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp
==============================================================================
--- branches/release/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp (original)
+++ branches/release/boost/interprocess/smart_ptr/detail/sp_counted_impl.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/streams/bufferstream.hpp
==============================================================================
--- branches/release/boost/interprocess/streams/bufferstream.hpp (original)
+++ branches/release/boost/interprocess/streams/bufferstream.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/sync/interprocess_sharable_mutex.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/interprocess_sharable_mutex.hpp (original)
+++ branches/release/boost/interprocess/sync/interprocess_sharable_mutex.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/sync/interprocess_upgradable_mutex.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/interprocess_upgradable_mutex.hpp (original)
+++ branches/release/boost/interprocess/sync/interprocess_upgradable_mutex.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/sync/named_sharable_mutex.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/named_sharable_mutex.hpp (original)
+++ branches/release/boost/interprocess/sync/named_sharable_mutex.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/sync/named_upgradable_mutex.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/named_upgradable_mutex.hpp (original)
+++ branches/release/boost/interprocess/sync/named_upgradable_mutex.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/sync/shm/named_condition.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/shm/named_condition.hpp (original)
+++ branches/release/boost/interprocess/sync/shm/named_condition.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/sync/shm/named_condition_any.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/shm/named_condition_any.hpp (original)
+++ branches/release/boost/interprocess/sync/shm/named_condition_any.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/sync/shm/named_mutex.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/shm/named_mutex.hpp (original)
+++ branches/release/boost/interprocess/sync/shm/named_mutex.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/sync/shm/named_recursive_mutex.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/shm/named_recursive_mutex.hpp (original)
+++ branches/release/boost/interprocess/sync/shm/named_recursive_mutex.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/sync/shm/named_semaphore.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/shm/named_semaphore.hpp (original)
+++ branches/release/boost/interprocess/sync/shm/named_semaphore.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/sync/shm/named_upgradable_mutex.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/shm/named_upgradable_mutex.hpp (original)
+++ branches/release/boost/interprocess/sync/shm/named_upgradable_mutex.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/sync/windows/sync_utils.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/windows/sync_utils.hpp (original)
+++ branches/release/boost/interprocess/sync/windows/sync_utils.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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: branches/release/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp
==============================================================================
--- branches/release/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp (original)
+++ branches/release/boost/interprocess/sync/windows/winapi_semaphore_wrapper.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 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;
Modified: branches/release/libs/interprocess/doc/interprocess.qbk
==============================================================================
--- branches/release/libs/interprocess/doc/interprocess.qbk (original)
+++ branches/release/libs/interprocess/doc/interprocess.qbk 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -8,7 +8,7 @@
[library Boost.Interprocess
[quickbook 1.4]
[authors [Gaztanaga, Ion]]
- [copyright 2005- 2011 Ion Gaztanaga]
+ [copyright 2005-2012 Ion Gaztanaga]
[id interprocess]
[dirname interprocess]
[purpose Interprocess communication utilities]
@@ -3898,6 +3898,8 @@
[section:managed_memory_segment_multiple_allocations Multiple allocation functions]
+[caution This feature is experimental, interface and ABI are unstable]
+
If an application needs to allocate a lot of memory buffers but it needs
to deallocate them independently, the application is normally forced to loop
calling `allocate()`. Managed memory segments offer an alternative function
@@ -3917,33 +3919,26 @@
[c++]
- //!Allocates n_elements of elem_size bytes.
- multiallocation_iterator allocate_many(std::size_t elem_size, std::size_t min_elements, std::size_t preferred_elements, std::size_t &received_elements);
-
- //!Allocates n_elements, each one of elem_sizes[i] bytes.
- multiallocation_iterator allocate_many(const std::size_t *elem_sizes, std::size_t n_elements);
-
- //!Allocates n_elements of elem_size bytes. No throwing version.
- multiallocation_iterator allocate_many(std::size_t elem_size, std::size_t min_elements, std::size_t preferred_elements, std::size_t &received_elements, std::nothrow_t nothrow);
-
- //!Allocates n_elements, each one of elem_sizes[i] bytes. No throwing version.
- multiallocation_iterator allocate_many(const std::size_t *elem_sizes, std::size_t n_elements, std::nothrow_t nothrow);
-
-All functions return a `multiallocation iterator` that can be used to obtain
-pointers to memory the user can overwrite. A `multiallocation_iterator`:
-
-* Becomes invalidated if the memory is pointing to is deallocated or
- the next iterators (which previously were reachable with `operator++`)
- become invalid.
-* Returned from `allocate_many` can be checked in a boolean expression to
- know if the allocation has been successful.
-* A default constructed `multiallocation iterator` indicates
- both an invalid iterator and the "end" iterator.
-* Dereferencing an iterator (`operator *()`) returns a `char &`
- referencing the first byte user can overwrite
- in the memory buffer.
-* The iterator category depends on the memory allocation algorithm,
- but it's at least a forward iterator.
+ //!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);
+
+ //!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);
+
+ //!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);
+
+ //!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);
+
+ //!Deallocates all elements contained in chain.
+ //!Never throws.
+ void deallocate_many(multiallocation_chain &chain);
Here is a small example showing all this functionality:
@@ -6716,16 +6711,25 @@
[section:release_notes Release Notes]
+[section:release_notes_boost_1_53_00 Boost 1.53 Release]
+
+* 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.
+
+[endsect]
+
[section:release_notes_boost_1_52_00 Boost 1.52 Release]
* Added `shrink_by` and `advise` functions in `mapped_region`.
-* [*ABI breaking]Reimplemented `message_queue` with a circular buffer index (the
+* [*ABI breaking:] Reimplemented `message_queue` with a circular buffer index (the
old behavior used an ordered array, leading to excessive copies). This
should greatly increase performance but breaks ABI. Old behaviour/ABI can be used
undefining macro `BOOST_INTERPROCESS_MSG_QUEUE_CIRCULAR_INDEX` in `boost/interprocess/detail/workaround.hpp`
* Improved `message_queue` insertion time avoiding priority search for common cases
(both array and circular buffer configurations).
-* Implemented `sharable_mutex` and `interproces_condition_any`.
+* Implemented `interproces_sharable_mutex` and `interproces_condition_any`.
* Improved `offset_ptr` performance.
* Added integer overflow checks.
Modified: branches/release/libs/interprocess/example/comp_doc_anonymous_semaphoreB.cpp
==============================================================================
--- branches/release/libs/interprocess/example/comp_doc_anonymous_semaphoreB.cpp (original)
+++ branches/release/libs/interprocess/example/comp_doc_anonymous_semaphoreB.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -49,6 +49,9 @@
const int NumMsg = 100;
int extracted_data [NumMsg];
+ //<-
+ (void)extracted_data;
+ //->
//Extract the data
for(int i = 0; i < NumMsg; ++i){
Modified: branches/release/libs/interprocess/example/doc_managed_copy_on_write.cpp
==============================================================================
--- branches/release/libs/interprocess/example/doc_managed_copy_on_write.cpp (original)
+++ branches/release/libs/interprocess/example/doc_managed_copy_on_write.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -25,12 +25,14 @@
//Define file names
//<-
#if 1
- std::string managed_file(boost::interprocess::ipcdetail::get_temporary_path());
- managed_file += "/"; managed_file += test::get_process_id_name();
- const char *ManagedFile = managed_file.c_str();
- std::string managed_file2(boost::interprocess::ipcdetail::get_temporary_path());
- managed_file2 += "/"; managed_file2 += test::get_process_id_name(); managed_file2 += "_2";
- const char *ManagedFile2 = managed_file2.c_str();
+ const char *ManagedFile = 0;
+ const char *ManagedFile2 = 0;
+ std::string managed_file_name(boost::interprocess::ipcdetail::get_temporary_path());
+ managed_file_name += "/"; managed_file_name += test::get_process_id_name();
+ ManagedFile = managed_file_name.c_str();
+ std::string managed_file2_name(boost::interprocess::ipcdetail::get_temporary_path());
+ managed_file2_name += "/"; managed_file2_name += test::get_process_id_name(); managed_file2_name += "_2";
+ ManagedFile2 = managed_file2_name.c_str();
#else
//->
const char *ManagedFile = "MyManagedFile";
Modified: branches/release/libs/interprocess/example/doc_managed_multiple_allocation.cpp
==============================================================================
--- branches/release/libs/interprocess/example/doc_managed_multiple_allocation.cpp (original)
+++ branches/release/libs/interprocess/example/doc_managed_multiple_allocation.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -54,7 +54,8 @@
//->
//Allocate 16 elements of 100 bytes in a single call. Non-throwing version.
- multiallocation_chain chain(managed_shm.allocate_many(100, 16, std::nothrow));
+ multiallocation_chain chain;
+ managed_shm.allocate_many(std::nothrow, 100, 16, chain);
//Check if the memory allocation was successful
if(chain.empty()) return 1;
@@ -82,8 +83,8 @@
for(std::size_t i = 0; i < 10; ++i)
sizes[i] = i*3;
- chain = managed_shm.allocate_many(sizes, 10);
- managed_shm.deallocate_many(boost::move(chain));
+ managed_shm.allocate_many(sizes, 10, 1, chain);
+ managed_shm.deallocate_many(chain);
return 0;
}
//]
Modified: branches/release/libs/interprocess/example/doc_multi_index.cpp
==============================================================================
--- branches/release/libs/interprocess/example/doc_multi_index.cpp (original)
+++ branches/release/libs/interprocess/example/doc_multi_index.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -14,10 +14,17 @@
#include <boost/interprocess/allocators/allocator.hpp>
#include <boost/interprocess/containers/string.hpp>
+//<-
+//Shield against external warnings
+#include <boost/interprocess/detail/config_external_begin.hpp>
+//->
+
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
+
//<-
+#include <boost/interprocess/detail/config_external_end.hpp>
#include "../test/get_process_id_name.hpp"
//->
Modified: branches/release/libs/interprocess/example/doc_unordered_map.cpp
==============================================================================
--- branches/release/libs/interprocess/example/doc_unordered_map.cpp (original)
+++ branches/release/libs/interprocess/example/doc_unordered_map.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -13,9 +13,21 @@
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
+//<-
+//Shield against external warnings
+#include <boost/interprocess/detail/config_external_begin.hpp>
+//->
+
#include <boost/unordered_map.hpp> //boost::unordered_map
+
+//<-
+#include <boost/interprocess/detail/config_external_end.hpp>
+#include "../test/get_process_id_name.hpp"
+//->
+
#include <functional> //std::equal_to
#include <boost/functional/hash.hpp> //boost::hash
+
//<-
#include "../test/get_process_id_name.hpp"
//->
Modified: branches/release/libs/interprocess/proj/vc7ide/adaptive_node_pool_test.vcproj
==============================================================================
--- branches/release/libs/interprocess/proj/vc7ide/adaptive_node_pool_test.vcproj (original)
+++ branches/release/libs/interprocess/proj/vc7ide/adaptive_node_pool_test.vcproj 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -81,7 +81,7 @@
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="0"/>
+ DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Modified: branches/release/libs/interprocess/proj/vc7ide/flat_tree_test.vcproj
==============================================================================
--- branches/release/libs/interprocess/proj/vc7ide/flat_tree_test.vcproj (original)
+++ branches/release/libs/interprocess/proj/vc7ide/flat_tree_test.vcproj 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -82,7 +82,7 @@
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="0"/>
+ DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Modified: branches/release/libs/interprocess/proj/vc7ide/interprocesslib.vcproj
==============================================================================
--- branches/release/libs/interprocess/proj/vc7ide/interprocesslib.vcproj (original)
+++ branches/release/libs/interprocess/proj/vc7ide/interprocesslib.vcproj 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -488,6 +488,12 @@
RelativePath="..\..\..\..\boost\interprocess\detail\config_end.hpp">
</File>
<File
+ RelativePath="..\..\..\..\boost\interprocess\detail\config_external_begin.hpp">
+ </File>
+ <File
+ RelativePath="..\..\..\..\boost\interprocess\detail\config_external_end.hpp">
+ </File>
+ <File
RelativePath="..\..\..\..\boost\interprocess\detail\file_locking_helpers.hpp">
</File>
<File
Modified: branches/release/libs/interprocess/proj/vc7ide/list_test.vcproj
==============================================================================
--- branches/release/libs/interprocess/proj/vc7ide/list_test.vcproj (original)
+++ branches/release/libs/interprocess/proj/vc7ide/list_test.vcproj 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -74,6 +74,7 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
+ Optimization="2"
AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
RuntimeLibrary="2"
@@ -82,7 +83,7 @@
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="0"/>
+ DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Modified: branches/release/libs/interprocess/proj/vc7ide/offset_ptr_test.vcproj
==============================================================================
--- branches/release/libs/interprocess/proj/vc7ide/offset_ptr_test.vcproj (original)
+++ branches/release/libs/interprocess/proj/vc7ide/offset_ptr_test.vcproj 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -72,6 +72,7 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
+ Optimization="3"
AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
RuntimeLibrary="2"
@@ -80,7 +81,7 @@
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="0"/>
+ DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Modified: branches/release/libs/interprocess/proj/vc7ide/stable_vector_test.vcproj
==============================================================================
--- branches/release/libs/interprocess/proj/vc7ide/stable_vector_test.vcproj (original)
+++ branches/release/libs/interprocess/proj/vc7ide/stable_vector_test.vcproj 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -72,7 +72,7 @@
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
- Optimization="2"
+ Optimization="3"
InlineFunctionExpansion="0"
AdditionalIncludeDirectories="../../../.."
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
Modified: branches/release/libs/interprocess/proj/vc7ide/vector_test.vcproj
==============================================================================
--- branches/release/libs/interprocess/proj/vc7ide/vector_test.vcproj (original)
+++ branches/release/libs/interprocess/proj/vc7ide/vector_test.vcproj 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -80,7 +80,7 @@
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="0"/>
+ DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Modified: branches/release/libs/interprocess/test/condition_test_template.hpp
==============================================================================
--- branches/release/libs/interprocess/test/condition_test_template.hpp (original)
+++ branches/release/libs/interprocess/test/condition_test_template.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -70,8 +70,8 @@
class binder
{
public:
- binder(const F& func, const T& param)
- : func(func), param(param) { }
+ binder(const F& f, const T& p)
+ : func(f), param(p) { }
void operator()() const { func(param); }
private:
Modified: branches/release/libs/interprocess/test/deque_test.cpp
==============================================================================
--- branches/release/libs/interprocess/test/deque_test.cpp (original)
+++ branches/release/libs/interprocess/test/deque_test.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -144,8 +144,7 @@
/*try*/{
//Compare several shared memory deque operations with std::deque
- int i;
- for(i = 0; i < max*50; ++i){
+ for(int i = 0; i < max*50; ++i){
IntType move_me(i);
shmdeque->insert(shmdeque->end(), boost::move(move_me));
stddeque->insert(stddeque->end(), i);
@@ -157,7 +156,7 @@
shmdeque->clear();
stddeque->clear();
- for(i = 0; i < max*50; ++i){
+ for(int i = 0; i < max*50; ++i){
IntType move_me(i);
shmdeque->push_back(boost::move(move_me));
stddeque->push_back(i);
@@ -169,7 +168,7 @@
shmdeque->clear();
stddeque->clear();
- for(i = 0; i < max*50; ++i){
+ for(int i = 0; i < max*50; ++i){
IntType move_me(i);
shmdeque->push_front(boost::move(move_me));
stddeque->push_front(i);
@@ -241,7 +240,7 @@
if(!test::CheckEqualContainers(shmdeque, stddeque)) return false;
- for(i = 0; i < max; ++i){
+ for(int i = 0; i < max; ++i){
IntType move_me(i);
shmdeque->insert(shmdeque->begin(), boost::move(move_me));
stddeque->insert(stddeque->begin(), i);
Modified: branches/release/libs/interprocess/test/expand_bwd_test_allocator.hpp
==============================================================================
--- branches/release/libs/interprocess/test/expand_bwd_test_allocator.hpp (original)
+++ branches/release/libs/interprocess/test/expand_bwd_test_allocator.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -66,13 +66,16 @@
typedef boost::interprocess::version_type<expand_bwd_test_allocator, 2> version;
+ //Dummy multiallocation chain
+ struct multiallocation_chain{};
+
template<class T2>
struct rebind
{ typedef expand_bwd_test_allocator<T2> other; };
//!Constructor from the segment manager. Never throws
- expand_bwd_test_allocator(T *buffer, size_type size, difference_type offset)
- : mp_buffer(buffer), m_size(size)
+ expand_bwd_test_allocator(T *buf, size_type sz, difference_type offset)
+ : mp_buffer(buf), m_size(sz)
, m_offset(offset), m_allocations(0){ }
//!Constructor from other expand_bwd_test_allocator. Never throws
Modified: branches/release/libs/interprocess/test/intersegment_ptr_test.cpp
==============================================================================
--- branches/release/libs/interprocess/test/intersegment_ptr_test.cpp (original)
+++ branches/release/libs/interprocess/test/intersegment_ptr_test.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -130,15 +130,15 @@
//ptr++
penew = p0;
for(int j = 0; j != NumValues; ++j){
- pint_t p = penew;
- if(p != penew++)
+ pint_t pnew_copy = penew;
+ if(pnew_copy != penew++)
return false;
}
//ptr--
p0 = pe;
for(int j = 0; j != NumValues; ++j){
- pint_t p = p0;
- if(p != p0--)
+ pint_t p0_copy = p0;
+ if(p0_copy != p0--)
return false;
}
Modified: branches/release/libs/interprocess/test/mapped_file_test.cpp
==============================================================================
--- branches/release/libs/interprocess/test/mapped_file_test.cpp (original)
+++ branches/release/libs/interprocess/test/mapped_file_test.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -46,10 +46,10 @@
class mapped_file_creation_test_wrapper
: public file_destroyer
, public boost::interprocess::ipcdetail::managed_open_or_create_impl
- <boost::interprocess::ipcdetail::file_wrapper>
+ <boost::interprocess::ipcdetail::file_wrapper, 0, true, false>
{
typedef boost::interprocess::ipcdetail::managed_open_or_create_impl
- <boost::interprocess::ipcdetail::file_wrapper> mapped_file;
+ <boost::interprocess::ipcdetail::file_wrapper, 0, true, false> mapped_file;
public:
mapped_file_creation_test_wrapper(boost::interprocess::create_only_t)
: mapped_file(boost::interprocess::create_only, get_filename().c_str(), FileSize, read_write, 0, permissions())
@@ -67,7 +67,7 @@
int main ()
{
typedef boost::interprocess::ipcdetail::managed_open_or_create_impl
- <boost::interprocess::ipcdetail::file_wrapper> mapped_file;
+ <boost::interprocess::ipcdetail::file_wrapper, 0, true, false> mapped_file;
file_mapping::remove(get_filename().c_str());
test::test_named_creation<mapped_file_creation_test_wrapper>();
Modified: branches/release/libs/interprocess/test/memory_algorithm_test.cpp
==============================================================================
--- branches/release/libs/interprocess/test/memory_algorithm_test.cpp (original)
+++ branches/release/libs/interprocess/test/memory_algorithm_test.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -23,7 +23,7 @@
using namespace boost::interprocess;
-const int memsize = 16384;
+const int Memsize = 16384;
const char *const shMemName = test::get_process_id_name();
int test_simple_seq_fit()
@@ -37,7 +37,7 @@
//Create shared memory
shared_memory_object::remove(shMemName);
- my_managed_shared_memory segment(create_only, shMemName, memsize);
+ my_managed_shared_memory segment(create_only, shMemName, Memsize);
//Now take the segment manager and launch memory test
if(!test::test_all_allocation(*segment.get_segment_manager())){
@@ -58,7 +58,7 @@
//Create shared memory
shared_memory_object::remove(shMemName);
- my_managed_shared_memory segment(create_only, shMemName, memsize);
+ my_managed_shared_memory segment(create_only, shMemName, Memsize);
//Now take the segment manager and launch memory test
if(!test::test_all_allocation(*segment.get_segment_manager())){
Modified: branches/release/libs/interprocess/test/memory_algorithm_test_template.hpp
==============================================================================
--- branches/release/libs/interprocess/test/memory_algorithm_test_template.hpp (original)
+++ branches/release/libs/interprocess/test/memory_algorithm_test_template.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -673,7 +673,8 @@
typedef typename Allocator::multiallocation_chain multiallocation_chain;
std::vector<void*> buffers;
for(int i = 0; true; ++i){
- multiallocation_chain chain(a.allocate_many(i+1, (i+1)*2, std::nothrow));
+ multiallocation_chain chain;
+ a.allocate_many(std::nothrow, i+1, (i+1)*2, chain);
if(chain.empty())
break;
@@ -782,7 +783,8 @@
std::vector<void*> buffers;
for(int i = 0; true; ++i){
- multiallocation_chain chain(a.allocate_many(requested_sizes, ArraySize, 1, std::nothrow));
+ multiallocation_chain chain;
+ a.allocate_many(std::nothrow, requested_sizes, ArraySize, 1, chain);
if(chain.empty())
break;
typename multiallocation_chain::size_type n = chain.size();
@@ -851,6 +853,8 @@
bool test_many_deallocation(Allocator &a)
{
typedef typename Allocator::multiallocation_chain multiallocation_chain;
+
+ typedef typename Allocator::multiallocation_chain multiallocation_chain;
const std::size_t ArraySize = 11;
vector<multiallocation_chain> buffers;
typename Allocator::size_type requested_sizes[ArraySize];
@@ -861,13 +865,14 @@
{
for(int i = 0; true; ++i){
- multiallocation_chain chain = a.allocate_many(requested_sizes, ArraySize, 1, std::nothrow);
+ multiallocation_chain chain;
+ a.allocate_many(std::nothrow, requested_sizes, ArraySize, 1, chain);
if(chain.empty())
break;
buffers.push_back(boost::move(chain));
}
for(int i = 0, max = (int)buffers.size(); i != max; ++i){
- a.deallocate_many(boost::move(buffers[i]));
+ a.deallocate_many(buffers[i]);
}
buffers.clear();
bool ok = free_memory == a.get_free_memory() &&
@@ -877,13 +882,14 @@
{
for(int i = 0; true; ++i){
- multiallocation_chain chain(a.allocate_many(i*4, ArraySize, std::nothrow));
+ multiallocation_chain chain;
+ a.allocate_many(std::nothrow, i*4, ArraySize, chain);
if(chain.empty())
break;
buffers.push_back(boost::move(chain));
}
for(int i = 0, max = (int)buffers.size(); i != max; ++i){
- a.deallocate_many(boost::move(buffers[i]));
+ a.deallocate_many(buffers[i]);
}
buffers.clear();
Modified: branches/release/libs/interprocess/test/multi_index_test.cpp
==============================================================================
--- branches/release/libs/interprocess/test/multi_index_test.cpp (original)
+++ branches/release/libs/interprocess/test/multi_index_test.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -21,10 +21,19 @@
#include <boost/interprocess/containers/string.hpp>
+//<-
+//Shield against external warnings
+#include <boost/interprocess/detail/config_external_begin.hpp>
+//->
+
#include <boost/multi_index_container.hpp>
#include <boost/multi_index/member.hpp>
#include <boost/multi_index/ordered_index.hpp>
+//<-
+#include <boost/interprocess/detail/config_external_end.hpp>
+//->
+
using namespace boost::interprocess;
namespace bmi = boost::multi_index;
Modified: branches/release/libs/interprocess/test/named_allocation_test_template.hpp
==============================================================================
--- branches/release/libs/interprocess/test/named_allocation_test_template.hpp (original)
+++ branches/release/libs/interprocess/test/named_allocation_test_template.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -134,8 +134,8 @@
}
for(; named_beg != named_end; ++named_beg){
- const char_type *name = named_beg->name();
- aux_str = name;
+ const char_type *name_str = named_beg->name();
+ aux_str = name_str;
if(names.find(aux_str) == names.end()){
return 1;
}
@@ -144,7 +144,7 @@
return 1;
}
- const void *found_value = m.template find<char>(name).first;
+ const void *found_value = m.template find<char>(name_str).first;
if(found_value == 0)
return false;
Modified: branches/release/libs/interprocess/test/offset_ptr_test.cpp
==============================================================================
--- branches/release/libs/interprocess/test/offset_ptr_test.cpp (original)
+++ branches/release/libs/interprocess/test/offset_ptr_test.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -208,15 +208,15 @@
//ptr++
penew = p0;
for(int j = 0; j != NumValues; ++j){
- pint_t p = penew;
- if(p != penew++)
+ pint_t p_new_copy = penew;
+ if(p_new_copy != penew++)
return false;
}
//ptr--
p0 = pe;
for(int j = 0; j != NumValues; ++j){
- pint_t p = p0;
- if(p != p0--)
+ pint_t p0_copy = p0;
+ if(p0_copy != p0--)
return false;
}
@@ -290,3 +290,60 @@
}
#include <boost/interprocess/detail/config_end.hpp>
+
+/*
+//Offset ptr benchmark
+#include <vector>
+#include <iostream>
+#include <boost/interprocess/managed_shared_memory.hpp>
+#include <boost/interprocess/containers/vector.hpp>
+#include <boost/interprocess/allocators/allocator.hpp>
+#include <boost/timer.hpp>
+#include <cstddef>
+
+template<class InIt,
+ class Ty> inline
+ Ty accumulate2(InIt First, InIt Last, Ty Val)
+ { // return sum of Val and all in [First, Last)
+ for (; First != Last; ++First) //First = First + 1)
+ Val = Val + *First;
+ return (Val);
+ }
+
+template <typename Vector>
+void time_test(const Vector& vec, std::size_t iterations, const char* label) {
+ // assert(!vec.empty())
+ boost::timer t;
+ typename Vector::const_iterator first = vec.begin();
+ typename Vector::value_type result(0);
+ while (iterations != 0) {
+ result = accumulate2(first, first + vec.size(), result);
+ --iterations;
+ }
+ std::cout << label << t.elapsed() << " " << result << std::endl;
+}
+
+int main()
+{
+ using namespace boost::interprocess;
+ typedef allocator<double, managed_shared_memory::segment_manager> alloc_t;
+
+ std::size_t n = 0x1 << 26;
+ std::size_t file_size = n * sizeof(double) + 1000000;
+
+ {
+ shared_memory_object::remove("MyMappedFile");
+ managed_shared_memory segment(open_or_create, "MyMappedFile", file_size);
+ shared_memory_object::remove("MyMappedFile");
+ alloc_t alloc_inst(segment.get_segment_manager());
+ vector<double, alloc_t> v0(n, double(42.42), alloc_inst);
+ time_test(v0, 10, "iterator shared: ");
+ }
+ {
+ std::vector<double> v1(n, double(42.42));
+ time_test(v1, 10, "iterator non-shared: ");
+ }
+ return 0;
+}
+
+*/
\ No newline at end of file
Modified: branches/release/libs/interprocess/test/set_test.hpp
==============================================================================
--- branches/release/libs/interprocess/test/set_test.hpp (original)
+++ branches/release/libs/interprocess/test/set_test.hpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -157,8 +157,7 @@
return 1;
}
- int i, j;
- for(i = 0; i < max/2; ++i){
+ for(int i = 0; i < max/2; ++i){
IntType move_me(i);
shmset->insert(boost::move(move_me));
stdset->insert(i);
@@ -352,7 +351,7 @@
}
}
- for(i = 0; i < max/2; ++i){
+ for(int i = 0; i < max/2; ++i){
IntType move_me(i);
shmset->insert(shmset->begin(), boost::move(move_me));
stdset->insert(stdset->begin(), i);
@@ -375,79 +374,81 @@
return 1;
}
- for(i = 0; i < max; ++i){
- IntType move_me(i);
- shmset->insert(shmset->begin(), boost::move(move_me));
- stdset->insert(stdset->begin(), i);
- //PrintContainers(shmset, stdset);
- IntType move_me2(i);
- shmmultiset->insert(shmmultiset->begin(), boost::move(move_me2));
- stdmultiset->insert(stdmultiset->begin(), i);
- //PrintContainers(shmmultiset, stdmultiset);
- if(!CheckEqualContainers(shmset, stdset)){
- std::cout << "Error in shmset->insert(shmset->begin(), boost::move(move_me))" << std::endl;
- return 1;
- }
- if(!CheckEqualContainers(shmmultiset, stdmultiset)){
- std::cout << "Error in shmmultiset->insert(shmmultiset->begin(), boost::move(move_me2))" << std::endl;
- return 1;
- }
-
- IntType move_me3(i);
- shmset->insert(shmset->end(), boost::move(move_me3));
- stdset->insert(stdset->end(), i);
- IntType move_me4(i);
- shmmultiset->insert(shmmultiset->end(), boost::move(move_me4));
- stdmultiset->insert(stdmultiset->end(), i);
- if(!CheckEqualContainers(shmset, stdset)){
- std::cout << "Error in shmset->insert(shmset->end(), boost::move(move_me3))" << std::endl;
- return 1;
- }
- if(!CheckEqualContainers(shmmultiset, stdmultiset)){
- std::cout << "Error in shmmultiset->insert(shmmultiset->end(), boost::move(move_me4))" << std::endl;
- return 1;
- }
+ for(int i = 0; i < max; ++i){
{
- IntType move_me(i);
- shmset->insert(shmset->upper_bound(move_me), boost::move(move_me));
- stdset->insert(stdset->upper_bound(i), i);
- //PrintContainers(shmset, stdset);
- IntType move_me2(i);
- shmmultiset->insert(shmmultiset->upper_bound(move_me2), boost::move(move_me2));
- stdmultiset->insert(stdmultiset->upper_bound(i), i);
- //PrintContainers(shmmultiset, stdmultiset);
- if(!CheckEqualContainers(shmset, stdset)){
- std::cout << "Error in shmset->insert(shmset->upper_bound(move_me), boost::move(move_me))" << std::endl;
- return 1;
- }
- if(!CheckEqualContainers(shmmultiset, stdmultiset)){
- std::cout << "Error in shmmultiset->insert(shmmultiset->upper_bound(move_me2), boost::move(move_me2))" << std::endl;
- return 1;
- }
+ IntType move_me(i);
+ shmset->insert(shmset->begin(), boost::move(move_me));
+ stdset->insert(stdset->begin(), i);
+ //PrintContainers(shmset, stdset);
+ IntType move_me2(i);
+ shmmultiset->insert(shmmultiset->begin(), boost::move(move_me2));
+ stdmultiset->insert(stdmultiset->begin(), i);
+ //PrintContainers(shmmultiset, stdmultiset);
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->insert(shmset->begin(), boost::move(move_me))" << std::endl;
+ return 1;
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->insert(shmmultiset->begin(), boost::move(move_me2))" << std::endl;
+ return 1;
+ }
+ IntType move_me3(i);
+ shmset->insert(shmset->end(), boost::move(move_me3));
+ stdset->insert(stdset->end(), i);
+ IntType move_me4(i);
+ shmmultiset->insert(shmmultiset->end(), boost::move(move_me4));
+ stdmultiset->insert(stdmultiset->end(), i);
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->insert(shmset->end(), boost::move(move_me3))" << std::endl;
+ return 1;
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->insert(shmmultiset->end(), boost::move(move_me4))" << std::endl;
+ return 1;
+ }
}
{
- IntType move_me(i);
- shmset->insert(shmset->lower_bound(move_me), boost::move(move_me2));
- stdset->insert(stdset->lower_bound(i), i);
- //PrintContainers(shmset, stdset);
- IntType move_me2(i);
- shmmultiset->insert(shmmultiset->lower_bound(move_me2), boost::move(move_me2));
- stdmultiset->insert(stdmultiset->lower_bound(i), i);
- //PrintContainers(shmmultiset, stdmultiset);
- if(!CheckEqualContainers(shmset, stdset)){
- std::cout << "Error in shmset->insert(shmset->lower_bound(move_me), boost::move(move_me2))" << std::endl;
- return 1;
- }
- if(!CheckEqualContainers(shmmultiset, stdmultiset)){
- std::cout << "Error in shmmultiset->insert(shmmultiset->lower_bound(move_me2), boost::move(move_me2))" << std::endl;
- return 1;
+ IntType move_me(i);
+ shmset->insert(shmset->upper_bound(move_me), boost::move(move_me));
+ stdset->insert(stdset->upper_bound(i), i);
+ //PrintContainers(shmset, stdset);
+ IntType move_me2(i);
+ shmmultiset->insert(shmmultiset->upper_bound(move_me2), boost::move(move_me2));
+ stdmultiset->insert(stdmultiset->upper_bound(i), i);
+ //PrintContainers(shmmultiset, stdmultiset);
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->insert(shmset->upper_bound(move_me), boost::move(move_me))" << std::endl;
+ return 1;
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->insert(shmmultiset->upper_bound(move_me2), boost::move(move_me2))" << std::endl;
+ return 1;
+ }
}
+ {
+ IntType move_me(i);
+ IntType move_me2(i);
+ shmset->insert(shmset->lower_bound(move_me), boost::move(move_me2));
+ stdset->insert(stdset->lower_bound(i), i);
+ //PrintContainers(shmset, stdset);
+ move_me2 = i;
+ shmmultiset->insert(shmmultiset->lower_bound(move_me2), boost::move(move_me2));
+ stdmultiset->insert(stdmultiset->lower_bound(i), i);
+ //PrintContainers(shmmultiset, stdmultiset);
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->insert(shmset->lower_bound(move_me), boost::move(move_me2))" << std::endl;
+ return 1;
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->insert(shmmultiset->lower_bound(move_me2), boost::move(move_me2))" << std::endl;
+ return 1;
+ }
}
}
//Compare count with std containers
- for(i = 0; i < max; ++i){
+ for(int i = 0; i < max; ++i){
IntType count_me(i);
if(shmset->count(count_me) != stdset->count(i)){
return -1;
@@ -463,8 +464,8 @@
shmset->clear();
shmmultiset->clear();
- for(j = 0; j < 3; ++j)
- for(i = 0; i < 100; ++i){
+ for(int j = 0; j < 3; ++j)
+ for(int i = 0; i < 100; ++i){
IntType move_me(i);
shmset->insert(boost::move(move_me));
IntType move_me2(i);
@@ -532,8 +533,7 @@
MyStdMultiSet *stdmultiset = new MyStdMultiSet;
- int i;
- for(i = 0; i < max; ++i){
+ for(int i = 0; i < max; ++i){
IntType move_me(i);
shmset->insert(boost::move(move_me));
stdset->insert(i);
Modified: branches/release/libs/interprocess/test/shared_memory_test.cpp
==============================================================================
--- branches/release/libs/interprocess/test/shared_memory_test.cpp (original)
+++ branches/release/libs/interprocess/test/shared_memory_test.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -31,7 +31,7 @@
}
};
-typedef ipcdetail::managed_open_or_create_impl<shared_memory_object> shared_memory;
+typedef ipcdetail::managed_open_or_create_impl<shared_memory_object, 0, true, false> shared_memory;
//This wrapper is necessary to have a common constructor
//in generic named_creation_template functions
Modified: branches/release/libs/interprocess/test/unordered_test.cpp
==============================================================================
--- branches/release/libs/interprocess/test/unordered_test.cpp (original)
+++ branches/release/libs/interprocess/test/unordered_test.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -12,9 +12,19 @@
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/allocators/allocator.hpp>
#include "get_process_id_name.hpp"
+
+//<-
+//Shield against external warnings
+#include <boost/interprocess/detail/config_external_begin.hpp>
+//->
+
#include <boost/unordered_map.hpp>
#include <boost/unordered_set.hpp>
+//<-
+#include <boost/interprocess/detail/config_external_end.hpp>
+//->
+
#include <functional> //std::equal_to
#include <boost/functional/hash.hpp> //boost::hash
Modified: branches/release/libs/interprocess/test/user_buffer_test.cpp
==============================================================================
--- branches/release/libs/interprocess/test/user_buffer_test.cpp (original)
+++ branches/release/libs/interprocess/test/user_buffer_test.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -105,7 +105,6 @@
(heap_buffer.get_segment_manager());
//Alias heap list
- typedef std::list<int> MyStdList;
MyStdList *stdlist = new MyStdList;
int i;
Modified: branches/release/libs/interprocess/test/windows_shared_memory_mapping_test.cpp
==============================================================================
--- branches/release/libs/interprocess/test/windows_shared_memory_mapping_test.cpp (original)
+++ branches/release/libs/interprocess/test/windows_shared_memory_mapping_test.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -26,12 +26,12 @@
{
try{
const char *names[2] = { test::get_process_id_name(), 0 };
- for(unsigned int i = 0; i < sizeof(names)/sizeof(names[0]); ++i)
+ for(unsigned int i_name = 0; i_name < sizeof(names)/sizeof(names[0]); ++i_name)
{
const std::size_t FileSize = 99999*2;
//Create a file mapping
windows_shared_memory mapping
- (create_only, names[i], read_write, FileSize);
+ (create_only, names[i_name], read_write, FileSize);
{
Modified: branches/release/libs/interprocess/test/windows_shared_memory_test.cpp
==============================================================================
--- branches/release/libs/interprocess/test/windows_shared_memory_test.cpp (original)
+++ branches/release/libs/interprocess/test/windows_shared_memory_test.cpp 2012-12-01 18:08:28 EST (Sat, 01 Dec 2012)
@@ -33,7 +33,7 @@
static const std::size_t ShmSize = 1000;
typedef ipcdetail::managed_open_or_create_impl
- <windows_shared_memory, 0, false> windows_shared_memory_t;
+ <windows_shared_memory, 0, false, false> windows_shared_memory_t;
//This wrapper is necessary to have a common constructor
//in generic named_creation_template functions
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