|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r81521 - in trunk/libs/interprocess: doc example proj/vc7ide test
From: igaztanaga_at_[hidden]
Date: 2012-11-24 16:14:05
Author: igaztanaga
Date: 2012-11-24 16:14:02 EST (Sat, 24 Nov 2012)
New Revision: 81521
URL: http://svn.boost.org/trac/boost/changeset/81521
Log:
* Fixed GCC -Wshadow warnings.
* Experimental multiple allocation interface improved and changed again. Still unstable.
* Replaced deprecated BOOST_NO_XXXX with newer BOOST_NO_CXX11_XXX macros.
* [*ABI breaking]: changed node pool allocators internals for improved efficiency.
Text files modified:
trunk/libs/interprocess/doc/interprocess.qbk | 64 +++++++++--------
trunk/libs/interprocess/example/comp_doc_anonymous_semaphoreB.cpp | 3
trunk/libs/interprocess/example/doc_managed_copy_on_write.cpp | 14 ++-
trunk/libs/interprocess/example/doc_managed_multiple_allocation.cpp | 7 +
trunk/libs/interprocess/example/doc_multi_index.cpp | 7 +
trunk/libs/interprocess/example/doc_unordered_map.cpp | 12 +++
trunk/libs/interprocess/proj/vc7ide/adaptive_node_pool_test.vcproj | 2
trunk/libs/interprocess/proj/vc7ide/flat_tree_test.vcproj | 2
trunk/libs/interprocess/proj/vc7ide/interprocesslib.vcproj | 6 +
trunk/libs/interprocess/proj/vc7ide/list_test.vcproj | 3
trunk/libs/interprocess/proj/vc7ide/offset_ptr_test.vcproj | 3
trunk/libs/interprocess/proj/vc7ide/stable_vector_test.vcproj | 2
trunk/libs/interprocess/proj/vc7ide/vector_test.vcproj | 2
trunk/libs/interprocess/test/condition_test_template.hpp | 4
trunk/libs/interprocess/test/deque_test.cpp | 9 +-
trunk/libs/interprocess/test/expand_bwd_test_allocator.hpp | 7 +
trunk/libs/interprocess/test/intersegment_ptr_test.cpp | 8 +-
trunk/libs/interprocess/test/mapped_file_test.cpp | 6
trunk/libs/interprocess/test/memory_algorithm_test.cpp | 6
trunk/libs/interprocess/test/memory_algorithm_test_template.hpp | 18 +++-
trunk/libs/interprocess/test/multi_index_test.cpp | 9 ++
trunk/libs/interprocess/test/named_allocation_test_template.hpp | 6
trunk/libs/interprocess/test/offset_ptr_test.cpp | 65 +++++++++++++++++-
trunk/libs/interprocess/test/set_test.hpp | 142 ++++++++++++++++++++--------------------
trunk/libs/interprocess/test/shared_memory_test.cpp | 2
trunk/libs/interprocess/test/unordered_test.cpp | 10 ++
trunk/libs/interprocess/test/user_buffer_test.cpp | 1
trunk/libs/interprocess/test/windows_shared_memory_mapping_test.cpp | 4
trunk/libs/interprocess/test/windows_shared_memory_test.cpp | 2
29 files changed, 273 insertions(+), 153 deletions(-)
Modified: trunk/libs/interprocess/doc/interprocess.qbk
==============================================================================
--- trunk/libs/interprocess/doc/interprocess.qbk (original)
+++ trunk/libs/interprocess/doc/interprocess.qbk 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/example/comp_doc_anonymous_semaphoreB.cpp
==============================================================================
--- trunk/libs/interprocess/example/comp_doc_anonymous_semaphoreB.cpp (original)
+++ trunk/libs/interprocess/example/comp_doc_anonymous_semaphoreB.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/example/doc_managed_copy_on_write.cpp
==============================================================================
--- trunk/libs/interprocess/example/doc_managed_copy_on_write.cpp (original)
+++ trunk/libs/interprocess/example/doc_managed_copy_on_write.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/example/doc_managed_multiple_allocation.cpp
==============================================================================
--- trunk/libs/interprocess/example/doc_managed_multiple_allocation.cpp (original)
+++ trunk/libs/interprocess/example/doc_managed_multiple_allocation.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/example/doc_multi_index.cpp
==============================================================================
--- trunk/libs/interprocess/example/doc_multi_index.cpp (original)
+++ trunk/libs/interprocess/example/doc_multi_index.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/example/doc_unordered_map.cpp
==============================================================================
--- trunk/libs/interprocess/example/doc_unordered_map.cpp (original)
+++ trunk/libs/interprocess/example/doc_unordered_map.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/proj/vc7ide/adaptive_node_pool_test.vcproj
==============================================================================
--- trunk/libs/interprocess/proj/vc7ide/adaptive_node_pool_test.vcproj (original)
+++ trunk/libs/interprocess/proj/vc7ide/adaptive_node_pool_test.vcproj 2012-11-24 16:14:02 EST (Sat, 24 Nov 2012)
@@ -81,7 +81,7 @@
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="0"/>
+ DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Modified: trunk/libs/interprocess/proj/vc7ide/flat_tree_test.vcproj
==============================================================================
--- trunk/libs/interprocess/proj/vc7ide/flat_tree_test.vcproj (original)
+++ trunk/libs/interprocess/proj/vc7ide/flat_tree_test.vcproj 2012-11-24 16:14:02 EST (Sat, 24 Nov 2012)
@@ -82,7 +82,7 @@
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="0"/>
+ DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Modified: trunk/libs/interprocess/proj/vc7ide/interprocesslib.vcproj
==============================================================================
--- trunk/libs/interprocess/proj/vc7ide/interprocesslib.vcproj (original)
+++ trunk/libs/interprocess/proj/vc7ide/interprocesslib.vcproj 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/proj/vc7ide/list_test.vcproj
==============================================================================
--- trunk/libs/interprocess/proj/vc7ide/list_test.vcproj (original)
+++ trunk/libs/interprocess/proj/vc7ide/list_test.vcproj 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/proj/vc7ide/offset_ptr_test.vcproj
==============================================================================
--- trunk/libs/interprocess/proj/vc7ide/offset_ptr_test.vcproj (original)
+++ trunk/libs/interprocess/proj/vc7ide/offset_ptr_test.vcproj 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/proj/vc7ide/stable_vector_test.vcproj
==============================================================================
--- trunk/libs/interprocess/proj/vc7ide/stable_vector_test.vcproj (original)
+++ trunk/libs/interprocess/proj/vc7ide/stable_vector_test.vcproj 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/proj/vc7ide/vector_test.vcproj
==============================================================================
--- trunk/libs/interprocess/proj/vc7ide/vector_test.vcproj (original)
+++ trunk/libs/interprocess/proj/vc7ide/vector_test.vcproj 2012-11-24 16:14:02 EST (Sat, 24 Nov 2012)
@@ -80,7 +80,7 @@
UsePrecompiledHeader="0"
WarningLevel="4"
Detect64BitPortabilityProblems="TRUE"
- DebugInformationFormat="0"/>
+ DebugInformationFormat="3"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Modified: trunk/libs/interprocess/test/condition_test_template.hpp
==============================================================================
--- trunk/libs/interprocess/test/condition_test_template.hpp (original)
+++ trunk/libs/interprocess/test/condition_test_template.hpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/deque_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/deque_test.cpp (original)
+++ trunk/libs/interprocess/test/deque_test.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/expand_bwd_test_allocator.hpp
==============================================================================
--- trunk/libs/interprocess/test/expand_bwd_test_allocator.hpp (original)
+++ trunk/libs/interprocess/test/expand_bwd_test_allocator.hpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/intersegment_ptr_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/intersegment_ptr_test.cpp (original)
+++ trunk/libs/interprocess/test/intersegment_ptr_test.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/mapped_file_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/mapped_file_test.cpp (original)
+++ trunk/libs/interprocess/test/mapped_file_test.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/memory_algorithm_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/memory_algorithm_test.cpp (original)
+++ trunk/libs/interprocess/test/memory_algorithm_test.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/memory_algorithm_test_template.hpp
==============================================================================
--- trunk/libs/interprocess/test/memory_algorithm_test_template.hpp (original)
+++ trunk/libs/interprocess/test/memory_algorithm_test_template.hpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/multi_index_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/multi_index_test.cpp (original)
+++ trunk/libs/interprocess/test/multi_index_test.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/named_allocation_test_template.hpp
==============================================================================
--- trunk/libs/interprocess/test/named_allocation_test_template.hpp (original)
+++ trunk/libs/interprocess/test/named_allocation_test_template.hpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/offset_ptr_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/offset_ptr_test.cpp (original)
+++ trunk/libs/interprocess/test/offset_ptr_test.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/set_test.hpp
==============================================================================
--- trunk/libs/interprocess/test/set_test.hpp (original)
+++ trunk/libs/interprocess/test/set_test.hpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/shared_memory_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/shared_memory_test.cpp (original)
+++ trunk/libs/interprocess/test/shared_memory_test.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/unordered_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/unordered_test.cpp (original)
+++ trunk/libs/interprocess/test/unordered_test.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/user_buffer_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/user_buffer_test.cpp (original)
+++ trunk/libs/interprocess/test/user_buffer_test.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/windows_shared_memory_mapping_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/windows_shared_memory_mapping_test.cpp (original)
+++ trunk/libs/interprocess/test/windows_shared_memory_mapping_test.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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: trunk/libs/interprocess/test/windows_shared_memory_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/windows_shared_memory_test.cpp (original)
+++ trunk/libs/interprocess/test/windows_shared_memory_test.cpp 2012-11-24 16:14:02 EST (Sat, 24 Nov 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