|
Boost-Commit : |
From: igaztanaga_at_[hidden]
Date: 2008-05-23 18:13:12
Author: igaztanaga
Date: 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
New Revision: 45692
URL: http://svn.boost.org/trac/boost/changeset/45692
Log:
#1912: some copy edits on boost.intrusive
#1932: move semantics for shared objects
#1635: Incomplete include guard in boost/intrusive
Added:
trunk/libs/interprocess/example/doc_managed_copy_on_write.cpp (contents, props changed)
trunk/libs/interprocess/proj/vc7ide/doc_managed_copy_on_write.vcproj (contents, props changed)
trunk/libs/interprocess/proj/vc7ide/intersegment_ptr_test.vcproj (contents, props changed)
trunk/libs/interprocess/test/intersegment_ptr_test.cpp (contents, props changed)
Text files modified:
trunk/libs/interprocess/doc/interprocess.qbk | 28 ++++++++++++++--
trunk/libs/interprocess/proj/to-do.txt | 6 +++
trunk/libs/interprocess/proj/vc7ide/Interprocess.sln | 16 +++++++++
trunk/libs/interprocess/test/cached_adaptive_pool_test.cpp | 1
trunk/libs/interprocess/test/cached_node_allocator_test.cpp | 1
trunk/libs/interprocess/test/file_mapping_test.cpp | 7 ++++
trunk/libs/interprocess/test/managed_mapped_file_test.cpp | 36 +++++++++++++++++++++
trunk/libs/interprocess/test/managed_shared_memory_test.cpp | 35 ++++++++++++++++++++
trunk/libs/interprocess/test/managed_windows_shared_memory_test.cpp | 67 +++++++++++++++++++++++++++++++--------
trunk/libs/interprocess/test/mapped_file_test.cpp | 5 ++
trunk/libs/interprocess/test/node_allocator_test.cpp | 1
trunk/libs/interprocess/test/node_pool_test.hpp | 36 ++++++++++----------
trunk/libs/interprocess/test/private_adaptive_pool_test.cpp | 1
trunk/libs/interprocess/test/private_node_allocator_test.cpp | 1
trunk/libs/interprocess/test/shared_memory_mapping_test.cpp | 7 ++++
trunk/libs/interprocess/test/shared_memory_test.cpp | 5 ++
trunk/libs/interprocess/test/user_buffer_test.cpp | 12 +++++++
trunk/libs/interprocess/test/vector_test.hpp | 4 -
18 files changed, 230 insertions(+), 39 deletions(-)
Modified: trunk/libs/interprocess/doc/interprocess.qbk
==============================================================================
--- trunk/libs/interprocess/doc/interprocess.qbk (original)
+++ trunk/libs/interprocess/doc/interprocess.qbk 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -3096,6 +3096,8 @@
//
managed_shared_memory segment (open_only, "MySharedMemory");//Shared memory object name[c++]
+[c++]
+
//1. If the segment was previously created
// equivalent to "open_only".
//2. Otherwise, equivalent to "open_only" (size is ignored)
@@ -3258,6 +3260,21 @@
we will use managed shared memory in our examples. We can do the same with
memory mapped files or other managed memory segment classes.
+[section:copy_on_write Opening managed shared memory and mapped files with Copy On Write mode]
+
+When mapping a memory segment based on shared memory or files, there is an option to
+open them using `open_copy_on_write` option. This option is similar to `open_only` but
+every change the programmer does with this managed segment is kept private to this process
+and is not translated to the underlying device (shared memory or file).
+
+The underlying shared memory or file is opened as read-only so several processes can
+share an initial managed segment and make private changes to it. Here's an example:
+
+[import ../example/doc_managed_copy_on_write.cpp]
+[doc_managed_copy_on_write]
+
+[endsect]
+
[section:allocate_deallocate Allocating fragments of a managed memory segment]
If a basic raw-byte allocation is needed from a managed memory
@@ -3888,7 +3905,7 @@
* If the parameter `command` only contains the value `expand_bwd` (with optional
additional `nothrow_allocation`), the allocator will try to increase the size of
the memory block referenced by pointer `reuse_ptr` only moving the start of the
- block to a returned new position new_ptr. If it's not possible, it will try to
+ block to a returned new position `new_ptr`. If it's not possible, it will try to
move the start of the block as much as possible as long as this results in
`size(new_ptr) >= limit_size`. Success is reported only if this results in
`limit_size <= size(new_ptr)`.
@@ -3896,7 +3913,7 @@
* If the parameter `command` only contains the value `allocate_new` (with optional
additional `nothrow_allocation`), the allocator will try to allocate memory for
`preferred_size` objects. If it's not possible it will try to allocate memory for
- at least limit_size` objects.
+ at least `limit_size` objects.
* If the parameter `command` only contains a combination of `expand_fwd` and
`allocate_new`, (with optional additional `nothrow_allocation`) the allocator will
@@ -3951,8 +3968,8 @@
* If the user chooses `char` as template argument and a backwards expansion is
performed, although properly aligned, the returned buffer might not be
suitable because the distance between the new beginning and the old beginning
- might not multiple of the type the user wants to construct, because due to internal
- restriction the expansion can be slightly bigger than the requested. [*When
+ might not multiple of the type the user wants to construct, since due to internal
+ restrictions the expansion can be slightly bigger than the requested bytes. [*When
performing backwards expansion, if you have already constructed objects in the
old buffer, make sure to specify correctly the type.]
@@ -6456,6 +6473,9 @@
[section:release_notes_boost_1_36_00 Boost 1.36 Release]
* Added anonymous shared memory for UNIX systems.
+* Fixed erroneous `void` return types from `flat_map::erase()` functions.
+* Fixed missing move semantics on managed memory classes.
+* Added copy_on_write option for shared memory and mapped file managed classes.
[endsect]
Added: trunk/libs/interprocess/example/doc_managed_copy_on_write.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/example/doc_managed_copy_on_write.cpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -0,0 +1,67 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2006-2008. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+#include <boost/interprocess/detail/config_begin.hpp>
+//[doc_managed_copy_on_write
+#include <boost/interprocess/managed_mapped_file.hpp>
+#include <fstream> //std::fstream
+#include <cstdio> //std::remove
+
+int main()
+{
+ using namespace boost::interprocess;
+
+ //Try to erase any previous managed segment with the same name
+ std::remove("MyManagedFile");
+ std::remove("MyManagedFile2");
+
+ try{
+ //Create an named integer in a managed mapped file
+ managed_mapped_file managed_file(create_only, "MyManagedFile", 65536);
+ managed_file.construct<int>("MyInt")(0u);
+
+ //Now create a copy on write version
+ managed_mapped_file managed_file_cow(open_copy_on_write, "MyManagedFile");
+
+ //Erase the int and create a new one
+ if(!managed_file_cow.destroy<int>("MyInt"))
+ throw int(0);
+ managed_file_cow.construct<int>("MyInt2");
+
+ //Check changes
+ if(managed_file_cow.find<int>("MyInt").first && !managed_file_cow.find<int>("MyInt2").first)
+ throw int(0);
+
+ //Check the original is intact
+ if(!managed_file.find<int>("MyInt").first && managed_file.find<int>("MyInt2").first)
+ throw int(0);
+
+ { //Dump the modified copy on write segment to a file
+ std::fstream file("MyManagedFile2", std::ios_base::out | std::ios_base::trunc | std::ios_base::binary);
+ if(!file)
+ throw int(0);
+ file.write((const char *)managed_file_cow.get_address(), managed_file_cow.get_size());
+ }
+
+ //Now open the modified file and test changes
+ managed_mapped_file managed_file_cow2(open_only, "MyManagedFile2");
+ if(managed_file_cow2.find<int>("MyInt").first && !managed_file_cow2.find<int>("MyInt2").first)
+ throw int(0);
+ }
+ catch(...){
+ std::remove("MyManagedFile");
+ std::remove("MyManagedFile2");
+ throw;
+ }
+ std::remove("MyManagedFile");
+ std::remove("MyManagedFile2");
+ return 0;
+}
+//]
+#include <boost/interprocess/detail/config_end.hpp>
Modified: trunk/libs/interprocess/proj/to-do.txt
==============================================================================
--- trunk/libs/interprocess/proj/to-do.txt (original)
+++ trunk/libs/interprocess/proj/to-do.txt 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -52,3 +52,9 @@
-> barrier_test fails on MacOS X on PowerPC.
-> void allocator instantiations fail.
+
+-> Read-only managed classes. They should avoid internal locking and map memory as read-only
+
+-> add private_read_only to mapped_region to support MAP_PRIVATE plus PROT_READ
+
+-> add contiguous_elements option to burst allocation
Modified: trunk/libs/interprocess/proj/vc7ide/Interprocess.sln
==============================================================================
--- trunk/libs/interprocess/proj/vc7ide/Interprocess.sln (original)
+++ trunk/libs/interprocess/proj/vc7ide/Interprocess.sln 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -443,6 +443,14 @@
ProjectSection(ProjectDependencies) = postProject
EndProjectSection
EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "intersegment_ptr_test", "intersegment_ptr_test.vcproj", "{5E81CD01-4FA2-2A96-84FE-DA631CA20962}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "doc_managed_copy_on_write", "doc_managed_copy_on_write.vcproj", "{8E0C437E-3613-FD46-F3AE-876A0731CA85}"
+ ProjectSection(ProjectDependencies) = postProject
+ EndProjectSection
+EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
Debug = Debug
@@ -895,6 +903,14 @@
{58CCE183-6092-48FE-A4F7-BA0D3A792639}.Debug.Build.0 = Debug|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792639}.Release.ActiveCfg = Release|Win32
{58CCE183-6092-48FE-A4F7-BA0D3A792639}.Release.Build.0 = Release|Win32
+ {5E81CD01-4FA2-2A96-84FE-DA631CA20962}.Debug.ActiveCfg = Debug|Win32
+ {5E81CD01-4FA2-2A96-84FE-DA631CA20962}.Debug.Build.0 = Debug|Win32
+ {5E81CD01-4FA2-2A96-84FE-DA631CA20962}.Release.ActiveCfg = Release|Win32
+ {5E81CD01-4FA2-2A96-84FE-DA631CA20962}.Release.Build.0 = Release|Win32
+ {8E0C437E-3613-FD46-F3AE-876A0731CA85}.Debug.ActiveCfg = Debug|Win32
+ {8E0C437E-3613-FD46-F3AE-876A0731CA85}.Debug.Build.0 = Debug|Win32
+ {8E0C437E-3613-FD46-F3AE-876A0731CA85}.Release.ActiveCfg = Release|Win32
+ {8E0C437E-3613-FD46-F3AE-876A0731CA85}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
Added: trunk/libs/interprocess/proj/vc7ide/doc_managed_copy_on_write.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/proj/vc7ide/doc_managed_copy_on_write.vcproj 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -0,0 +1,134 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="doc_managed_copy_on_write"
+ ProjectGUID="{8E0C437E-3613-FD46-F3AE-876A0731CA85}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../Bin/Win32/Debug"
+ IntermediateDirectory="Debug/doc_managed_copy_on_write"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ DisableLanguageExtensions="FALSE"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/doc_managed_copy_on_write_d.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/doc_managed_copy_on_write.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ FixedBaseAddress="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="../../Bin/Win32/Release"
+ IntermediateDirectory="Release/doc_managed_copy_on_write"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ RuntimeLibrary="2"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/doc_managed_copy_on_write.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{854247C1-16A8-DA5A-4367-62FA3EE7FA1A}">
+ <File
+ RelativePath="..\..\example\doc_managed_copy_on_write.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Added: trunk/libs/interprocess/proj/vc7ide/intersegment_ptr_test.vcproj
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/proj/vc7ide/intersegment_ptr_test.vcproj 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -0,0 +1,133 @@
+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="7.10"
+ Name="intersegment_ptr_test"
+ ProjectGUID="{5E81CD01-4FA2-2A96-84FE-DA631CA20962}"
+ Keyword="Win32Proj">
+ <Platforms>
+ <Platform
+ Name="Win32"/>
+ </Platforms>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ OutputDirectory="../../Bin/Win32/Debug"
+ IntermediateDirectory="Debug/intersegment_ptr_test"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ Optimization="0"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ MinimalRebuild="TRUE"
+ BasicRuntimeChecks="3"
+ RuntimeLibrary="3"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="3"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/intersegment_ptr_test_d.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ ProgramDatabaseFile="$(OutDir)/intersegment_ptr_test.pdb"
+ SubSystem="1"
+ TargetMachine="1"
+ FixedBaseAddress="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ OutputDirectory="../../Bin/Win32/Release"
+ IntermediateDirectory="Release/intersegment_ptr_test"
+ ConfigurationType="1"
+ CharacterSet="2">
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories="../../../.."
+ PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;BOOST_DATE_TIME_NO_LIB"
+ RuntimeLibrary="2"
+ TreatWChar_tAsBuiltInType="TRUE"
+ ForceConformanceInForLoopScope="FALSE"
+ UsePrecompiledHeader="0"
+ WarningLevel="4"
+ Detect64BitPortabilityProblems="TRUE"
+ DebugInformationFormat="0"/>
+ <Tool
+ Name="VCCustomBuildTool"/>
+ <Tool
+ Name="VCLinkerTool"
+ AdditionalDependencies="winmm.lib"
+ OutputFile="$(OutDir)/intersegment_ptr_test.exe"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories="../../../../stage/lib"
+ GenerateDebugInformation="TRUE"
+ SubSystem="1"
+ OptimizeReferences="2"
+ EnableCOMDATFolding="2"
+ TargetMachine="1"/>
+ <Tool
+ Name="VCMIDLTool"/>
+ <Tool
+ Name="VCPostBuildEventTool"/>
+ <Tool
+ Name="VCPreBuildEventTool"/>
+ <Tool
+ Name="VCPreLinkEventTool"/>
+ <Tool
+ Name="VCResourceCompilerTool"/>
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"/>
+ <Tool
+ Name="VCXMLDataGeneratorTool"/>
+ <Tool
+ Name="VCWebDeploymentTool"/>
+ <Tool
+ Name="VCManagedWrapperGeneratorTool"/>
+ <Tool
+ Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{C32215BF-AD75-A753-3124-36742A2ADF1C}">
+ <File
+ RelativePath="..\..\test\intersegment_ptr_test.cpp">
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
Modified: trunk/libs/interprocess/test/cached_adaptive_pool_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/cached_adaptive_pool_test.cpp (original)
+++ trunk/libs/interprocess/test/cached_adaptive_pool_test.cpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -11,6 +11,7 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/containers/list.hpp>
+#include <boost/interprocess/containers/vector.hpp>
#include <boost/interprocess/allocators/cached_adaptive_pool.hpp>
#include "print_container.hpp"
#include "dummy_test_allocator.hpp"
Modified: trunk/libs/interprocess/test/cached_node_allocator_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/cached_node_allocator_test.cpp (original)
+++ trunk/libs/interprocess/test/cached_node_allocator_test.cpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -11,6 +11,7 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/containers/list.hpp>
+#include <boost/interprocess/containers/vector.hpp>
#include <boost/interprocess/allocators/cached_node_allocator.hpp>
#include "print_container.hpp"
#include "dummy_test_allocator.hpp"
Modified: trunk/libs/interprocess/test/file_mapping_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/file_mapping_test.cpp (original)
+++ trunk/libs/interprocess/test/file_mapping_test.cpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -122,6 +122,13 @@
}
}
}
+ {
+ //Now test move semantics
+ file_mapping mapping(test::get_process_id_name(), read_only);
+ file_mapping move_ctor(move(mapping));
+ file_mapping move_assign;
+ move_assign = move(move_ctor);
+ }
}
catch(std::exception &exc){
std::remove(test::get_process_id_name());
Added: trunk/libs/interprocess/test/intersegment_ptr_test.cpp
==============================================================================
--- (empty file)
+++ trunk/libs/interprocess/test/intersegment_ptr_test.cpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -0,0 +1,404 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Ion Gaztanaga 2007. Distributed under the Boost
+// Software License, Version 1.0. (See accompanying file
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+//
+// See http://www.boost.org/libs/interprocess for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#include <boost/interprocess/detail/config_begin.hpp>
+
+#include <boost/interprocess/detail/intersegment_ptr.hpp>
+#include <boost/interprocess/detail/type_traits.hpp>
+#include <boost/interprocess/mapped_region.hpp> //mapped_region
+#include <boost/interprocess/anonymous_shared_memory.hpp> //anonymous_shared_memory
+#include <boost/interprocess/detail/managed_multi_shared_memory.hpp> //managed_multi_shared_memory
+#include <cstddef> //std::size_t
+
+
+using namespace boost::interprocess;
+
+bool test_types_and_convertions()
+{
+ typedef intersegment_ptr<int> pint_t;
+ typedef intersegment_ptr<const int> pcint_t;
+ typedef intersegment_ptr<volatile int> pvint_t;
+ typedef intersegment_ptr<const volatile int> pcvint_t;
+
+ if(!detail::is_same<pint_t::value_type, int>::value)
+ return false;
+ if(!detail::is_same<pcint_t::value_type, const int>::value)
+ return false;
+ if(!detail::is_same<pvint_t::value_type, volatile int>::value)
+ return false;
+ if(!detail::is_same<pcvint_t::value_type, const volatile int>::value)
+ return false;
+ int dummy_int = 9;
+
+ { pint_t pint(&dummy_int); pcint_t pcint(pint);
+ if(pcint.get() != &dummy_int) return false; }
+ { pint_t pint(&dummy_int); pvint_t pvint(pint);
+ if(pvint.get() != &dummy_int) return false; }
+ { pint_t pint(&dummy_int); pcvint_t pcvint(pint);
+ if(pcvint.get() != &dummy_int) return false; }
+ { pcint_t pcint(&dummy_int); pcvint_t pcvint(pcint);
+ if(pcvint.get() != &dummy_int) return false; }
+ { pvint_t pvint(&dummy_int); pcvint_t pcvint(pvint);
+ if(pcvint.get() != &dummy_int) return false; }
+
+ pint_t pint(0);
+ pcint_t pcint(0);
+ pvint_t pvint(0);
+ pcvint_t pcvint(0);
+
+ pint = &dummy_int;
+ pcint = &dummy_int;
+ pvint = &dummy_int;
+ pcvint = &dummy_int;
+
+ { pcint = pint; if(pcint.get() != &dummy_int) return false; }
+ { pvint = pint; if(pvint.get() != &dummy_int) return false; }
+ { pcvint = pint; if(pcvint.get() != &dummy_int) return false; }
+ { pcvint = pcint; if(pcvint.get() != &dummy_int) return false; }
+ { pcvint = pvint; if(pcvint.get() != &dummy_int) return false; }
+
+ if(!pint)
+ return false;
+
+ pint = 0;
+ if(pint)
+ return false;
+
+ return true;
+}
+
+bool test_arithmetic()
+{
+ typedef intersegment_ptr<int> pint_t;
+ const int NumValues = 5;
+ int values[NumValues];
+
+ //Initialize p
+ pint_t p = values;
+ if(p.get() != values)
+ return false;
+
+ //Initialize p + NumValues
+ pint_t pe = &values[NumValues];
+ if(pe == p)
+ return false;
+ if(pe.get() != &values[NumValues])
+ return false;
+
+ //ptr - ptr
+ if((pe - p) != NumValues)
+ return false;
+ //ptr - integer
+ if((pe - NumValues) != p)
+ return false;
+ //ptr + integer
+ if((p + NumValues) != pe)
+ return false;
+ //integer + ptr
+ if((NumValues + p) != pe)
+ return false;
+ //indexing
+ if(pint_t(&p[NumValues]) != pe)
+ return false;
+ if(pint_t(&pe[-NumValues]) != p)
+ return false;
+
+ //ptr -= integer
+ pint_t p0 = pe;
+ p0-= NumValues;
+ if(p != p0)
+ return false;
+ //ptr += integer
+ pint_t penew = p0;
+ penew += NumValues;
+ if(penew != pe)
+ return false;
+
+ //++ptr
+ penew = p0;
+ for(int j = 0; j != NumValues; ++j, ++penew);
+ if(penew != pe)
+ return false;
+ //--ptr
+ p0 = pe;
+ for(int j = 0; j != NumValues; ++j, --p0);
+ if(p != p0)
+ return false;
+ //ptr++
+ penew = p0;
+ for(int j = 0; j != NumValues; ++j){
+ pint_t p = penew;
+ if(p != penew++)
+ return false;
+ }
+ //ptr--
+ p0 = pe;
+ for(int j = 0; j != NumValues; ++j){
+ pint_t p = p0;
+ if(p != p0--)
+ return false;
+ }
+
+ return true;
+}
+
+bool test_comparison()
+{
+ typedef intersegment_ptr<int> pint_t;
+ const int NumValues = 5;
+ int values[NumValues];
+
+ //Initialize p
+ pint_t p = values;
+ if(p.get() != values)
+ return false;
+
+ //Initialize p + NumValues
+ pint_t pe = &values[NumValues];
+ if(pe == p)
+ return false;
+ if(pe.get() != &values[NumValues])
+ return false;
+
+ //operators
+ if(p == pe)
+ return false;
+ if(p != p)
+ return false;
+ if(!(p < pe))
+ return false;
+ if(!(p <= pe))
+ return false;
+ if(!(pe > p))
+ return false;
+ if(!(pe >= p))
+ return false;
+
+ return true;
+}
+
+struct segment_data
+{
+ int int0;
+ int int1;
+ intersegment_ptr<int> ptr0;
+ int int2;
+ int int3;
+};
+
+bool test_basic_comparisons()
+{
+ //Create aligned sections
+ const std::size_t PageSize = mapped_region::get_page_size();
+ mapped_region reg_0_0(anonymous_shared_memory(PageSize));
+ mapped_region reg_0_1(anonymous_shared_memory(PageSize));
+ mapped_region reg_1_0(anonymous_shared_memory(PageSize));
+ mapped_region reg_1_1(anonymous_shared_memory(PageSize));
+
+ if(sizeof(segment_data) > mapped_region::get_page_size())
+ return false;
+
+ segment_data &seg_0_0 = *((segment_data *)reg_0_0.get_address());
+ segment_data &seg_0_1 = *((segment_data *)reg_0_1.get_address());
+ segment_data &seg_1_0 = *((segment_data *)reg_1_0.get_address());
+ segment_data &seg_1_1 = *((segment_data *)reg_1_1.get_address());
+
+ //Some dummy multi_segment_services
+ multi_segment_services *services0 = (multi_segment_services *)0;
+ multi_segment_services *services1 = (multi_segment_services *)1;
+
+ const intersegment_ptr<int>::segment_group_id group_0_id =
+ intersegment_ptr<int>::new_segment_group(services0);
+ const intersegment_ptr<int>::segment_group_id group_1_id =
+ intersegment_ptr<int>::new_segment_group(services1);
+
+ {
+
+ //Now register the segments in the segment data-base
+ intersegment_ptr<int>::insert_mapping(group_0_id, &seg_0_0, PageSize);
+ intersegment_ptr<int>::insert_mapping(group_0_id, &seg_0_1, PageSize);
+ intersegment_ptr<int>::insert_mapping(group_1_id, &seg_1_0, PageSize);
+ intersegment_ptr<int>::insert_mapping(group_1_id, &seg_1_1, PageSize);
+ }
+
+ //Now do some testing...
+ {
+ //Same segment
+ seg_0_0.ptr0 = &seg_0_0.int0;
+ seg_0_1.ptr0 = &seg_0_1.int0;
+
+ if(seg_0_0.ptr0.get() != &seg_0_0.int0)
+ return false;
+ if(seg_0_1.ptr0.get() != &seg_0_1.int0)
+ return false;
+
+ //Try it again to make use of the already established relative addressing
+ seg_0_0.ptr0 = &seg_0_0.int1;
+ seg_0_1.ptr0 = &seg_0_1.int1;
+
+ if(seg_0_0.ptr0.get() != &seg_0_0.int1)
+ return false;
+ if(seg_0_1.ptr0.get() != &seg_0_1.int1)
+ return false;
+
+ //Set to null and try again
+ seg_0_0.ptr0 = 0;
+ seg_0_1.ptr0 = 0;
+
+ seg_0_0.ptr0 = &seg_0_0.int1;
+ seg_0_1.ptr0 = &seg_0_1.int1;
+
+ if(seg_0_0.ptr0.get() != &seg_0_0.int1)
+ return false;
+ if(seg_0_1.ptr0.get() != &seg_0_1.int1)
+ return false;
+
+ //Set to null and try again
+ int stack_int;
+ seg_0_0.ptr0 = &stack_int;
+ seg_0_1.ptr0 = &stack_int;
+
+ if(seg_0_0.ptr0.get() != &stack_int)
+ return false;
+ if(seg_0_1.ptr0.get() != &stack_int)
+ return false;
+ }
+
+ {
+ //Now use stack variables
+ intersegment_ptr<int> stack_0 = &seg_0_0.int2;
+ intersegment_ptr<int> stack_1 = &seg_1_1.int2;
+
+ if(stack_0.get() != &seg_0_0.int2)
+ return false;
+ if(stack_1.get() != &seg_1_1.int2)
+ return false;
+
+ //Now reuse stack variables knowing that there are on stack
+ stack_0 = &seg_0_0.int3;
+ stack_1 = &seg_1_1.int3;
+
+ if(stack_0.get() != &seg_0_0.int3)
+ return false;
+ if(stack_1.get() != &seg_1_1.int3)
+ return false;
+
+ //Now set to null and try it again
+ stack_0 = 0;
+ stack_1 = 0;
+
+ stack_0 = &seg_0_0.int3;
+ stack_1 = &seg_1_1.int3;
+
+ if(stack_0.get() != &seg_0_0.int3)
+ return false;
+ if(stack_1.get() != &seg_1_1.int3)
+ return false;
+ }
+ {
+ //Different segments in the same group
+ seg_0_0.ptr0 = &seg_0_1.int0;
+ seg_0_1.ptr0 = &seg_0_0.int0;
+
+ if(seg_0_0.ptr0.get() != &seg_0_1.int0)
+ return false;
+ if(seg_0_1.ptr0.get() != &seg_0_0.int0)
+ return false;
+
+ //Try it again to make use of the already established segmented addressing
+ seg_0_0.ptr0 = &seg_0_1.int1;
+ seg_0_1.ptr0 = &seg_0_0.int1;
+
+ if(seg_0_0.ptr0.get() != &seg_0_1.int1)
+ return false;
+ if(seg_0_1.ptr0.get() != &seg_0_0.int1)
+ return false;
+
+ //Set to null and try it again
+ seg_0_0.ptr0 = 0;
+ seg_0_1.ptr0 = 0;
+
+ seg_0_0.ptr0 = &seg_0_1.int1;
+ seg_0_1.ptr0 = &seg_0_0.int1;
+
+ if(seg_0_0.ptr0.get() != &seg_0_1.int1)
+ return false;
+ if(seg_0_1.ptr0.get() != &seg_0_0.int1)
+ return false;
+ }
+
+ {
+ //Different groups
+ seg_0_0.ptr0 = &seg_1_0.int0;
+ seg_0_1.ptr0 = &seg_1_1.int0;
+
+ if(seg_0_0.ptr0.get() != &seg_1_0.int0)
+ return false;
+ if(seg_0_1.ptr0.get() != &seg_1_1.int0)
+ return false;
+
+ //Try it again
+ seg_0_0.ptr0 = &seg_1_0.int1;
+ seg_0_1.ptr0 = &seg_1_1.int1;
+
+ if(seg_0_0.ptr0.get() != &seg_1_0.int1)
+ return false;
+ if(seg_0_1.ptr0.get() != &seg_1_1.int1)
+ return false;
+
+ //Set null and try it again
+ seg_0_0.ptr0 = 0;
+ seg_0_1.ptr0 = 0;
+
+ seg_0_0.ptr0 = &seg_1_0.int1;
+ seg_0_1.ptr0 = &seg_1_1.int1;
+
+ if(seg_0_0.ptr0.get() != &seg_1_0.int1)
+ return false;
+ if(seg_0_1.ptr0.get() != &seg_1_1.int1)
+ return false;
+ }
+
+ {
+ //Erase mappings
+ intersegment_ptr<int>::delete_group(group_0_id);
+ intersegment_ptr<int>::delete_group(group_1_id);
+ }
+ return true;
+}
+
+bool test_multi_segment_shared_memory()
+{
+ {
+ shared_memory_object::remove("kk0");
+ managed_multi_shared_memory mshm(create_only, "kk", 4096);
+ }
+
+ shared_memory_object::remove("kk0");
+ return true;
+}
+
+int main()
+{
+ if(!test_types_and_convertions())
+ return 1;
+ if(!test_arithmetic())
+ return 1;
+ if(!test_comparison())
+ return 1;
+ if(!test_basic_comparisons())
+ return 1;
+
+ if(!test_multi_segment_shared_memory())
+ return 1;
+ return 0;
+}
+
+#include <boost/interprocess/detail/config_end.hpp>
Modified: trunk/libs/interprocess/test/managed_mapped_file_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/managed_mapped_file_test.cpp (original)
+++ trunk/libs/interprocess/test/managed_mapped_file_test.cpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -89,6 +89,35 @@
}
{
+ {
+ //Map preexisting file again in copy-on-write
+ managed_mapped_file mfile(open_copy_on_write, FileName);
+
+ //Check vector is still there
+ MyVect *mfile_vect = mfile.find<MyVect>("MyVector").first;
+ if(!mfile_vect)
+ return -1;
+
+ //Erase vector
+ mfile.destroy_ptr(mfile_vect);
+
+ //Make sure vector is erased
+ mfile_vect = mfile.find<MyVect>("MyVector").first;
+ if(mfile_vect)
+ return -1;
+ }
+ //Now check vector is still in the file
+ {
+ //Map preexisting file again in copy-on-write
+ managed_mapped_file mfile(open_copy_on_write, FileName);
+
+ //Check vector is still there
+ MyVect *mfile_vect = mfile.find<MyVect>("MyVector").first;
+ if(!mfile_vect)
+ return -1;
+ }
+ }
+ {
std::size_t old_free_memory;
{
//Map preexisting file again in memory
@@ -162,6 +191,13 @@
if(next_file_size <= final_file_size)
return -1;
}
+ {
+ //Now test move semantics
+ managed_mapped_file original(open_only, FileName);
+ managed_mapped_file move_ctor(move(original));
+ managed_mapped_file move_assign;
+ move_assign = move(move_ctor);
+ }
}
std::remove(FileName);
Modified: trunk/libs/interprocess/test/managed_shared_memory_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/managed_shared_memory_test.cpp (original)
+++ trunk/libs/interprocess/test/managed_shared_memory_test.cpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -84,7 +84,35 @@
if(!shmem_vect)
return -1;
}
+ {
+ {
+ //Map preexisting shmem again in copy-on-write
+ managed_shared_memory shmem(open_copy_on_write, ShmemName);
+
+ //Check vector is still there
+ MyVect *shmem_vect = shmem.find<MyVect>("MyVector").first;
+ if(!shmem_vect)
+ return -1;
+
+ //Erase vector
+ shmem.destroy_ptr(shmem_vect);
+
+ //Make sure vector is erased
+ shmem_vect = shmem.find<MyVect>("MyVector").first;
+ if(shmem_vect)
+ return -1;
+ }
+ //Now check vector is still in the shmem
+ {
+ //Map preexisting shmem again in copy-on-write
+ managed_shared_memory shmem(open_copy_on_write, ShmemName);
+ //Check vector is still there
+ MyVect *shmem_vect = shmem.find<MyVect>("MyVector").first;
+ if(!shmem_vect)
+ return -1;
+ }
+ }
{
std::size_t old_free_memory;
{
@@ -159,6 +187,13 @@
if(next_shmem_size <= final_shmem_size)
return -1;
}
+ {
+ //Now test move semantics
+ managed_shared_memory original(open_only, ShmemName);
+ managed_shared_memory move_ctor(move(original));
+ managed_shared_memory move_assign;
+ move_assign = move(move_ctor);
+ }
}
shared_memory_object::remove(ShmemName);
Modified: trunk/libs/interprocess/test/managed_windows_shared_memory_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/managed_windows_shared_memory_test.cpp (original)
+++ trunk/libs/interprocess/test/managed_windows_shared_memory_test.cpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -72,20 +72,59 @@
//Construct a vector in the shared memory
w_shm_vect = w_shm.construct<MyVect> ("MyVector") (myallocator);
- //Map preexisting segment again in memory
- managed_windows_shared_memory w_shm_new(open_only, MemName);
-
- //Check vector is still there
- w_shm_vect = w_shm_new.find<MyVect>("MyVector").first;
- if(!w_shm_vect)
- return -1;
-
- if(w_shm_new.get_size() != w_shm.get_size())
- return 1;
- //Destroy and check it is not present
- w_shm_new.destroy_ptr(w_shm_vect);
- if(0 != w_shm_new.find<MyVect>("MyVector").first)
- return 1;
+ {
+ //Map preexisting segment again in memory
+ managed_windows_shared_memory w_shm_new(open_only, MemName);
+
+ //Check vector is still there
+ w_shm_vect = w_shm_new.find<MyVect>("MyVector").first;
+ if(!w_shm_vect)
+ return -1;
+
+ if(w_shm_new.get_size() != w_shm.get_size())
+ return 1;
+
+ {
+ {
+ //Map preexisting shmem again in copy-on-write
+ managed_windows_shared_memory shmem(open_copy_on_write, MemName);
+
+ //Check vector is still there
+ MyVect *shmem_vect = shmem.find<MyVect>("MyVector").first;
+ if(!shmem_vect)
+ return -1;
+
+ //Erase vector
+ shmem.destroy_ptr(shmem_vect);
+
+ //Make sure vector is erased
+ shmem_vect = shmem.find<MyVect>("MyVector").first;
+ if(shmem_vect)
+ return -1;
+ }
+ //Now check vector is still in the s
+ {
+ //Map preexisting shmem again in copy-on-write
+ managed_windows_shared_memory shmem(open_copy_on_write, MemName);
+
+ //Check vector is still there
+ MyVect *shmem_vect = shmem.find<MyVect>("MyVector").first;
+ if(!shmem_vect)
+ return -1;
+ }
+ }
+
+ //Destroy and check it is not present
+ w_shm_new.destroy_ptr(w_shm_vect);
+ if(0 != w_shm_new.find<MyVect>("MyVector").first)
+ return 1;
+
+ //Now test move semantics
+ managed_windows_shared_memory original(open_only, MemName);
+ managed_windows_shared_memory move_ctor(move(original));
+ managed_windows_shared_memory move_assign;
+ move_assign = move(move_ctor);
+ }
}
return 0;
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 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -74,6 +74,11 @@
//Overwrite all memory
std::memset(file1.get_user_address(), 0, file1.get_user_size());
+
+ //Now test move semantics
+ mapped_file move_ctor(move(file1));
+ mapped_file move_assign;
+ move_assign = move(move_ctor);
}
std::remove(FileName);
return 0;
Modified: trunk/libs/interprocess/test/node_allocator_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/node_allocator_test.cpp (original)
+++ trunk/libs/interprocess/test/node_allocator_test.cpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -11,6 +11,7 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/containers/list.hpp>
+#include <boost/interprocess/containers/vector.hpp>
#include <boost/interprocess/allocators/node_allocator.hpp>
#include "print_container.hpp"
#include "dummy_test_allocator.hpp"
Modified: trunk/libs/interprocess/test/node_pool_test.hpp
==============================================================================
--- trunk/libs/interprocess/test/node_pool_test.hpp (original)
+++ trunk/libs/interprocess/test/node_pool_test.hpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -25,7 +25,7 @@
struct test_node_pool
{
static bool allocate_then_deallocate(NodePool &pool);
- static bool deallocate_free_chunks(NodePool &pool);
+ static bool deallocate_free_blocks(NodePool &pool);
};
template <class NodePool>
@@ -60,7 +60,7 @@
return false;
}
- pool.deallocate_free_chunks();
+ pool.deallocate_free_blocks();
if(0 != pool.num_free_nodes()){
return false;
@@ -70,11 +70,11 @@
}
template <class NodePool>
-bool test_node_pool<NodePool>::deallocate_free_chunks(NodePool &pool)
+bool test_node_pool<NodePool>::deallocate_free_blocks(NodePool &pool)
{
- const std::size_t max_chunks = 10;
- const std::size_t max_nodes = max_chunks*pool.get_real_num_node();
- const std::size_t nodes_per_chunk = pool.get_real_num_node();
+ const std::size_t max_blocks = 10;
+ const std::size_t max_nodes = max_blocks*pool.get_real_num_node();
+ const std::size_t nodes_per_block = pool.get_real_num_node();
std::vector<void*> nodes;
@@ -93,25 +93,25 @@
return false;
}
- //Now deallocate one of each chunk per iteration
- for(std::size_t node_i = 0; node_i < nodes_per_chunk; ++node_i){
- //Deallocate a node per chunk
- for(std::size_t i = 0; i < max_chunks; ++i){
- pool.deallocate_node(nodes[i*nodes_per_chunk + node_i]);
+ //Now deallocate one of each block per iteration
+ for(std::size_t node_i = 0; node_i < nodes_per_block; ++node_i){
+ //Deallocate a node per block
+ for(std::size_t i = 0; i < max_blocks; ++i){
+ pool.deallocate_node(nodes[i*nodes_per_block + node_i]);
}
//Check that the free count is correct
- if(max_chunks*(node_i+1) != pool.num_free_nodes()){
+ if(max_blocks*(node_i+1) != pool.num_free_nodes()){
return false;
}
- //Now try to deallocate free chunks
- pool.deallocate_free_chunks();
+ //Now try to deallocate free blocks
+ pool.deallocate_free_blocks();
- //Until we don't deallocate the last node of every chunk
+ //Until we don't deallocate the last node of every block
//no node should be deallocated
- if(node_i != (nodes_per_chunk - 1)){
- if(max_chunks*(node_i+1) != pool.num_free_nodes()){
+ if(node_i != (nodes_per_block - 1)){
+ if(max_blocks*(node_i+1) != pool.num_free_nodes()){
return false;
}
}
@@ -149,7 +149,7 @@
//Now call each test
if(!test_node_pool_t::allocate_then_deallocate(*p))
return false;
- if(!test_node_pool_t::deallocate_free_chunks(*p))
+ if(!test_node_pool_t::deallocate_free_blocks(*p))
return false;
}
shared_memory_object::remove(test::get_process_id_name());
Modified: trunk/libs/interprocess/test/private_adaptive_pool_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/private_adaptive_pool_test.cpp (original)
+++ trunk/libs/interprocess/test/private_adaptive_pool_test.cpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -11,6 +11,7 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/containers/list.hpp>
+#include <boost/interprocess/containers/vector.hpp>
#include <boost/interprocess/allocators/private_adaptive_pool.hpp>
#include "print_container.hpp"
#include "dummy_test_allocator.hpp"
Modified: trunk/libs/interprocess/test/private_node_allocator_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/private_node_allocator_test.cpp (original)
+++ trunk/libs/interprocess/test/private_node_allocator_test.cpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -11,6 +11,7 @@
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/containers/list.hpp>
+#include <boost/interprocess/containers/vector.hpp>
#include <boost/interprocess/allocators/private_node_allocator.hpp>
#include "print_container.hpp"
#include "dummy_test_allocator.hpp"
Modified: trunk/libs/interprocess/test/shared_memory_mapping_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/shared_memory_mapping_test.cpp (original)
+++ trunk/libs/interprocess/test/shared_memory_mapping_test.cpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -136,6 +136,13 @@
}
}
}
+ {
+ //Now test move semantics
+ shared_memory_object mapping(open_only, test::get_process_id_name(), read_write);
+ shared_memory_object move_ctor(move(mapping));
+ shared_memory_object move_assign;
+ move_assign = move(move_ctor);
+ }
}
catch(std::exception &exc){
shared_memory_object::remove(test::get_process_id_name());
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 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -74,6 +74,11 @@
//Overwrite all memory
std::memset(shm1.get_user_address(), 0, shm1.get_user_size());
+
+ //Now test move semantics
+ shared_memory move_ctor(move(shm1));
+ shared_memory move_assign;
+ move_assign = move(move_ctor);
}
}
catch(std::exception &ex){
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 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -62,6 +62,18 @@
//Named new capable heap mem allocator
wmanaged_heap_memory heap_buffer(memsize);
+ //Test move semantics
+ {
+ wmanaged_external_buffer user_default;
+ wmanaged_external_buffer temp_external(move(user_buffer));
+ user_default = move(temp_external);
+ user_buffer = move(user_default);
+ wmanaged_heap_memory heap_default;
+ wmanaged_heap_memory temp_heap(move(heap_buffer));
+ heap_default = move(temp_heap);
+ heap_buffer = move(heap_default);
+ }
+
//Initialize memory
user_buffer.reserve_named_objects(100);
heap_buffer.reserve_named_objects(100);
Modified: trunk/libs/interprocess/test/vector_test.hpp
==============================================================================
--- trunk/libs/interprocess/test/vector_test.hpp (original)
+++ trunk/libs/interprocess/test/vector_test.hpp 2008-05-23 18:13:10 EDT (Fri, 23 May 2008)
@@ -15,9 +15,6 @@
#include <iostream>
#include <functional>
-#include <boost/interprocess/managed_shared_memory.hpp>
-#include <boost/interprocess/containers/vector.hpp>
-#include <boost/interprocess/indexes/flat_map_index.hpp>
#include <boost/interprocess/exceptions.hpp>
#include <boost/interprocess/detail/move_iterator.hpp>
#include <boost/interprocess/detail/move.hpp>
@@ -25,6 +22,7 @@
#include "check_equal_containers.hpp"
#include "movable_int.hpp"
#include <string>
+#include <vector>
#include "get_process_id_name.hpp"
namespace boost{
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