|
Boost-Commit : |
From: igaztanaga_at_[hidden]
Date: 2007-08-25 15:10:14
Author: igaztanaga
Date: 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
New Revision: 38951
URL: http://svn.boost.org/trac/boost/changeset/38951
Log:
#1211: Interprocess tests hang when run in parallel
#1080 boost::interprocess win32 global file mapping issue
Text files modified:
trunk/libs/interprocess/test/managed_mapped_file_test.cpp | 4
trunk/libs/interprocess/test/managed_windows_shared_memory_test.cpp | 4
trunk/libs/interprocess/test/map_test.hpp | 6
trunk/libs/interprocess/test/mapped_file_test.cpp | 4
trunk/libs/interprocess/test/memory_algorithm_test.cpp | 4
trunk/libs/interprocess/test/message_queue_test.cpp | 24 ++--
trunk/libs/interprocess/test/named_allocation_test_template.hpp | 4
trunk/libs/interprocess/test/named_condition_test.cpp | 40 ++++----
trunk/libs/interprocess/test/named_mutex_test.cpp | 18 ++--
trunk/libs/interprocess/test/named_recursive_mutex_test.cpp | 18 ++--
trunk/libs/interprocess/test/named_semaphore_test.cpp | 4
trunk/libs/interprocess/test/named_upgradable_mutex_test.cpp | 18 ++--
trunk/libs/interprocess/test/node_pool_test.cpp | 24 ++++-
trunk/libs/interprocess/test/null_index_test.cpp | 8
trunk/libs/interprocess/test/set_test.hpp | 164 ++++++++++++++++++++++++++++++---------
trunk/libs/interprocess/test/shared_memory_mapping_test.cpp | 16 +-
trunk/libs/interprocess/test/shared_memory_test.cpp | 4
trunk/libs/interprocess/test/shared_ptr_test.cpp | 43 +++++-----
trunk/libs/interprocess/test/string_test.cpp | 14 +-
trunk/libs/interprocess/test/tree_test.cpp | 2
trunk/libs/interprocess/test/unique_ptr_test.cpp | 51 +++--------
trunk/libs/interprocess/test/vector_test.cpp | 32 +++++--
trunk/libs/interprocess/test/windows_shared_memory_mapping_test.cpp | 14 +-
trunk/libs/interprocess/test/windows_shared_memory_test.cpp | 8
24 files changed, 308 insertions(+), 220 deletions(-)
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 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -14,14 +14,14 @@
#include <boost/interprocess/managed_mapped_file.hpp>
#include <cstdio>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
int main ()
{
const int FileSize = 65536;
- const char *const FileName = test::get_compiler_name();
+ const char *const FileName = test::get_process_id_name();
//STL compatible allocator object for memory-mapped file
typedef allocator<int, managed_mapped_file::segment_manager>
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 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -17,14 +17,14 @@
#include <boost/interprocess/managed_windows_shared_memory.hpp>
#include <cstdio>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
int main ()
{
const int MemSize = 65536;
- const char *const MemName = test::get_compiler_name();
+ const char *const MemName = test::get_process_id_name();
//STL compatible allocator object for shared memory
typedef allocator<int, managed_windows_shared_memory::segment_manager>
Modified: trunk/libs/interprocess/test/map_test.hpp
==============================================================================
--- trunk/libs/interprocess/test/map_test.hpp (original)
+++ trunk/libs/interprocess/test/map_test.hpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -21,7 +21,7 @@
#include <boost/interprocess/detail/utilities.hpp>
#include <boost/interprocess/detail/iterators.hpp>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
template<class T1, class T2, class T3, class T4>
bool operator ==(std::pair<T1, T2> &p1, std::pair<T1, T2> &p2)
@@ -44,7 +44,7 @@
typedef std::pair<IntType, IntType> IntPairType;
typedef typename MyStdMap::value_type StdPairType;
const int memsize = 65536;
- const char *const shMemName = test::get_compiler_name();
+ const char *const shMemName = test::get_process_id_name();
const int max = 100;
try{
@@ -338,7 +338,7 @@
typedef typename MyStdMap::value_type StdPairType;
const int memsize = 65536;
- const char *const shMemName = test::get_compiler_name();
+ const char *const shMemName = test::get_process_id_name();
const int max = 100;
try{
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 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -17,12 +17,12 @@
#include <cstdio>
#include <cstring>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
static const std::size_t FileSize = 1000;
-static const char * FileName = test::get_compiler_name();
+static const char * FileName = test::get_process_id_name();
struct file_destroyer
{
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 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -17,13 +17,13 @@
#include "memory_algorithm_test_template.hpp"
#include <iostream>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
int main ()
{
using namespace boost::interprocess;
const int memsize = 16384;
- const char *const shMemName = test::get_compiler_name();
+ const char *const shMemName = test::get_process_id_name();
{
//A shared memory with simple sequential fit algorithm
Modified: trunk/libs/interprocess/test/message_queue_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/message_queue_test.cpp (original)
+++ trunk/libs/interprocess/test/message_queue_test.cpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -21,7 +21,7 @@
#include <boost/thread.hpp>
#include <memory>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
#ifdef max
#undef max
@@ -40,12 +40,12 @@
//messages with same priority are received in fifo order
bool test_priority_order()
{
- message_queue::remove(test::get_compiler_name());
+ message_queue::remove(test::get_process_id_name());
{
message_queue mq1
- (open_or_create, test::get_compiler_name(), 100, sizeof(std::size_t)),
+ (open_or_create, test::get_process_id_name(), 100, sizeof(std::size_t)),
mq2
- (open_or_create, test::get_compiler_name(), 100, sizeof(std::size_t));
+ (open_or_create, test::get_process_id_name(), 100, sizeof(std::size_t));
//We test that the queue is ordered by priority and in the
//same priority, is a FIFO
@@ -77,7 +77,7 @@
tstamp_prev = tstamp;
}
}
- message_queue::remove(test::get_compiler_name());
+ message_queue::remove(test::get_process_id_name());
return true;
}
@@ -105,13 +105,13 @@
//Allocate a memory buffer to hold the destiny database using vector<char>
std::vector<char> buffer_destiny(BufferSize, 0);
- message_queue::remove(test::get_compiler_name());
+ message_queue::remove(test::get_process_id_name());
{
//Create the message-queues
- message_queue mq1(create_only, test::get_compiler_name(), 1, MaxMsgSize);
+ message_queue mq1(create_only, test::get_process_id_name(), 1, MaxMsgSize);
//Open previously created message-queue simulating other process
- message_queue mq2(open_only, test::get_compiler_name());
+ message_queue mq2(open_only, test::get_process_id_name());
//A managed heap memory to create the origin database
managed_heap_memory db_origin(buffer_destiny.size());
@@ -196,7 +196,7 @@
db_origin.destroy_ptr(map1);
db_destiny.destroy_ptr(map2);
}
- message_queue::remove(test::get_compiler_name());
+ message_queue::remove(test::get_process_id_name());
return true;
}
//]
@@ -221,11 +221,11 @@
bool test_buffer_overflow()
{
- boost::interprocess::message_queue::remove(test::get_compiler_name());
+ boost::interprocess::message_queue::remove(test::get_process_id_name());
{
std::auto_ptr<boost::interprocess::message_queue>
ptr(new boost::interprocess::message_queue
- (create_only, test::get_compiler_name(), 10, 10));
+ (create_only, test::get_process_id_name(), 10, 10));
pmessage_queue = ptr.get();
//Launch the receiver thread
@@ -240,7 +240,7 @@
thread.join();
}
- boost::interprocess::message_queue::remove(test::get_compiler_name());
+ boost::interprocess::message_queue::remove(test::get_process_id_name());
return true;
}
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 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -24,7 +24,7 @@
#include <iterator>
#include <set>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
namespace boost { namespace interprocess { namespace test {
@@ -427,7 +427,7 @@
{
using namespace boost::interprocess;
const int memsize = 163840;
- const char *const shMemName = test::get_compiler_name();
+ const char *const shMemName = test::get_process_id_name();
try
{
//A shared memory with rbtree best fit algorithm
Modified: trunk/libs/interprocess/test/named_condition_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/named_condition_test.cpp (original)
+++ trunk/libs/interprocess/test/named_condition_test.cpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -17,7 +17,7 @@
#include "condition_test_template.hpp"
#include "named_creation_template.hpp"
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
@@ -28,7 +28,7 @@
~condition_deleter()
{
if(name.empty())
- named_condition::remove(test::add_to_compiler_name("named_condition"));
+ named_condition::remove(test::add_to_process_id_name("named_condition"));
else
named_condition::remove(name.c_str());
}
@@ -43,9 +43,9 @@
named_condition_test_wrapper()
: named_condition(open_or_create,
- (test::add_to_compiler_name("test_cond") + boost::lexical_cast<std::string>(count)).c_str())
+ (test::add_to_process_id_name("test_cond") + boost::lexical_cast<std::string>(count)).c_str())
{
- condition_deleter::name += test::add_to_compiler_name("test_cond");
+ condition_deleter::name += test::add_to_process_id_name("test_cond");
condition_deleter::name += boost::lexical_cast<std::string>(count);
++count;
}
@@ -65,15 +65,15 @@
{
public:
named_condition_creation_test_wrapper(create_only_t)
- : named_condition(create_only, test::add_to_compiler_name("named_condition"))
+ : named_condition(create_only, test::add_to_process_id_name("named_condition"))
{}
named_condition_creation_test_wrapper(open_only_t)
- : named_condition(open_only, test::add_to_compiler_name("named_condition"))
+ : named_condition(open_only, test::add_to_process_id_name("named_condition"))
{}
named_condition_creation_test_wrapper(open_or_create_t)
- : named_condition(open_or_create, test::add_to_compiler_name("named_condition"))
+ : named_condition(open_or_create, test::add_to_process_id_name("named_condition"))
{}
};
@@ -84,7 +84,7 @@
~mutex_deleter()
{
if(name.empty())
- named_mutex::remove(test::add_to_compiler_name("named_mutex"));
+ named_mutex::remove(test::add_to_process_id_name("named_mutex"));
else
named_mutex::remove(name.c_str());
}
@@ -98,9 +98,9 @@
public:
named_mutex_test_wrapper()
: named_mutex(open_or_create,
- (test::add_to_compiler_name("test_mutex") + boost::lexical_cast<std::string>(count)).c_str())
+ (test::add_to_process_id_name("test_mutex") + boost::lexical_cast<std::string>(count)).c_str())
{
- mutex_deleter::name += test::add_to_compiler_name("test_mutex");
+ mutex_deleter::name += test::add_to_process_id_name("test_mutex");
mutex_deleter::name += boost::lexical_cast<std::string>(count);
++count;
}
@@ -117,11 +117,11 @@
{
try{
//Remove previous mutexes and conditions
- named_mutex::remove(test::add_to_compiler_name("test_mutex0"));
- named_condition::remove(test::add_to_compiler_name("test_cond0"));
- named_condition::remove(test::add_to_compiler_name("test_cond1"));
- named_condition::remove(test::add_to_compiler_name("named_condition"));
- named_mutex::remove(test::add_to_compiler_name("named_mutex"));
+ named_mutex::remove(test::add_to_process_id_name("test_mutex0"));
+ named_condition::remove(test::add_to_process_id_name("test_cond0"));
+ named_condition::remove(test::add_to_process_id_name("test_cond1"));
+ named_condition::remove(test::add_to_process_id_name("named_condition"));
+ named_mutex::remove(test::add_to_process_id_name("named_mutex"));
test::test_named_creation<named_condition_creation_test_wrapper>();
test::do_test_condition<named_condition_test_wrapper
@@ -131,11 +131,11 @@
std::cout << ex.what() << std::endl;
return 1;
}
- named_mutex::remove(test::add_to_compiler_name("test_mutex0"));
- named_condition::remove(test::add_to_compiler_name("test_cond0"));
- named_condition::remove(test::add_to_compiler_name("test_cond1"));
- named_condition::remove(test::add_to_compiler_name("named_condition"));
- named_mutex::remove(test::add_to_compiler_name("named_mutex"));
+ named_mutex::remove(test::add_to_process_id_name("test_mutex0"));
+ named_condition::remove(test::add_to_process_id_name("test_cond0"));
+ named_condition::remove(test::add_to_process_id_name("test_cond1"));
+ named_condition::remove(test::add_to_process_id_name("named_condition"));
+ named_mutex::remove(test::add_to_process_id_name("named_mutex"));
return 0;
}
Modified: trunk/libs/interprocess/test/named_mutex_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/named_mutex_test.cpp (original)
+++ trunk/libs/interprocess/test/named_mutex_test.cpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -14,14 +14,14 @@
#include "mutex_test_template.hpp"
#include "named_creation_template.hpp"
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
struct mutex_deleter
{
~mutex_deleter()
- { named_mutex::remove(test::get_compiler_name()); }
+ { named_mutex::remove(test::get_process_id_name()); }
};
//This wrapper is necessary to have a default constructor
@@ -31,7 +31,7 @@
{
public:
named_mutex_lock_test_wrapper()
- : named_mutex(open_or_create, test::get_compiler_name())
+ : named_mutex(open_or_create, test::get_process_id_name())
{}
};
@@ -42,32 +42,32 @@
{
public:
named_mutex_creation_test_wrapper(create_only_t)
- : named_mutex(create_only, test::get_compiler_name())
+ : named_mutex(create_only, test::get_process_id_name())
{}
named_mutex_creation_test_wrapper(open_only_t)
- : named_mutex(open_only, test::get_compiler_name())
+ : named_mutex(open_only, test::get_process_id_name())
{}
named_mutex_creation_test_wrapper(open_or_create_t)
- : named_mutex(open_or_create, test::get_compiler_name())
+ : named_mutex(open_or_create, test::get_process_id_name())
{}
};
int main ()
{
try{
- named_mutex::remove(test::get_compiler_name());
+ named_mutex::remove(test::get_process_id_name());
test::test_named_creation<named_mutex_creation_test_wrapper>();
test::test_all_lock<named_mutex_lock_test_wrapper>();
test::test_all_mutex<false, named_mutex_lock_test_wrapper>();
}
catch(std::exception &ex){
- named_mutex::remove(test::get_compiler_name());
+ named_mutex::remove(test::get_process_id_name());
std::cout << ex.what() << std::endl;
return 1;
}
- named_mutex::remove(test::get_compiler_name());
+ named_mutex::remove(test::get_process_id_name());
return 0;
}
Modified: trunk/libs/interprocess/test/named_recursive_mutex_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/named_recursive_mutex_test.cpp (original)
+++ trunk/libs/interprocess/test/named_recursive_mutex_test.cpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -15,14 +15,14 @@
#include "mutex_test_template.hpp"
#include "named_creation_template.hpp"
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
struct mutex_deleter
{
~mutex_deleter()
- { named_recursive_mutex::remove(test::get_compiler_name()); }
+ { named_recursive_mutex::remove(test::get_process_id_name()); }
};
//This wrapper is necessary to have a default constructor
@@ -32,7 +32,7 @@
{
public:
named_recursive_mutex_lock_test_wrapper()
- : named_recursive_mutex(open_or_create, test::get_compiler_name())
+ : named_recursive_mutex(open_or_create, test::get_process_id_name())
{}
};
@@ -43,33 +43,33 @@
{
public:
named_mutex_creation_test_wrapper(create_only_t)
- : named_recursive_mutex(create_only, test::get_compiler_name())
+ : named_recursive_mutex(create_only, test::get_process_id_name())
{}
named_mutex_creation_test_wrapper(open_only_t)
- : named_recursive_mutex(open_only, test::get_compiler_name())
+ : named_recursive_mutex(open_only, test::get_process_id_name())
{}
named_mutex_creation_test_wrapper(open_or_create_t)
- : named_recursive_mutex(open_or_create, test::get_compiler_name())
+ : named_recursive_mutex(open_or_create, test::get_process_id_name())
{}
};
int main ()
{
try{
- named_recursive_mutex::remove(test::get_compiler_name());
+ named_recursive_mutex::remove(test::get_process_id_name());
test::test_named_creation<named_mutex_creation_test_wrapper>();
test::test_all_lock<named_recursive_mutex_lock_test_wrapper>();
test::test_all_mutex<false, named_recursive_mutex_lock_test_wrapper>();
test::test_all_recursive_lock<named_recursive_mutex_lock_test_wrapper>();
}
catch(std::exception &ex){
- named_recursive_mutex::remove(test::get_compiler_name());
+ named_recursive_mutex::remove(test::get_process_id_name());
std::cout << ex.what() << std::endl;
return 1;
}
- named_recursive_mutex::remove(test::get_compiler_name());
+ named_recursive_mutex::remove(test::get_process_id_name());
return 0;
}
Modified: trunk/libs/interprocess/test/named_semaphore_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/named_semaphore_test.cpp (original)
+++ trunk/libs/interprocess/test/named_semaphore_test.cpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -15,13 +15,13 @@
#include "named_creation_template.hpp"
#include "mutex_test_template.hpp"
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
static const std::size_t SemCount = 1;
static const std::size_t RecSemCount = 100;
-static const char * SemName = test::get_compiler_name();
+static const char * SemName = test::get_process_id_name();
struct semaphore_deleter
{
Modified: trunk/libs/interprocess/test/named_upgradable_mutex_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/named_upgradable_mutex_test.cpp (original)
+++ trunk/libs/interprocess/test/named_upgradable_mutex_test.cpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -14,14 +14,14 @@
#include "named_creation_template.hpp"
#include <boost/interprocess/sync/named_upgradable_mutex.hpp>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
struct mutex_deleter
{
~mutex_deleter()
- { named_upgradable_mutex::remove(test::get_compiler_name()); }
+ { named_upgradable_mutex::remove(test::get_process_id_name()); }
};
//This wrapper is necessary to have a default constructor
@@ -31,7 +31,7 @@
{
public:
named_upgradable_mutex_lock_test_wrapper()
- : named_upgradable_mutex(open_or_create, test::get_compiler_name())
+ : named_upgradable_mutex(open_or_create, test::get_process_id_name())
{}
};
@@ -43,35 +43,35 @@
public:
named_upgradable_mutex_creation_test_wrapper
(create_only_t)
- : named_upgradable_mutex(create_only, test::get_compiler_name())
+ : named_upgradable_mutex(create_only, test::get_process_id_name())
{}
named_upgradable_mutex_creation_test_wrapper
(open_only_t)
- : named_upgradable_mutex(open_only, test::get_compiler_name())
+ : named_upgradable_mutex(open_only, test::get_process_id_name())
{}
named_upgradable_mutex_creation_test_wrapper
(open_or_create_t)
- : named_upgradable_mutex(open_or_create, test::get_compiler_name())
+ : named_upgradable_mutex(open_or_create, test::get_process_id_name())
{}
};
int main ()
{
try{
- named_upgradable_mutex::remove(test::get_compiler_name());
+ named_upgradable_mutex::remove(test::get_process_id_name());
test::test_named_creation<named_upgradable_mutex_creation_test_wrapper>();
// test::test_all_lock<named_upgradable_mutex_lock_test_wrapper>();
// test::test_all_mutex<true, named_upgradable_mutex_lock_test_wrapper>();
// test::test_all_sharable_mutex<true, named_upgradable_mutex_lock_test_wrapper>();
}
catch(std::exception &ex){
- named_upgradable_mutex::remove(test::get_compiler_name());
+ named_upgradable_mutex::remove(test::get_process_id_name());
std::cout << ex.what() << std::endl;
return 1;
}
- named_upgradable_mutex::remove(test::get_compiler_name());
+ named_upgradable_mutex::remove(test::get_process_id_name());
return 0;
}
Modified: trunk/libs/interprocess/test/node_pool_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/node_pool_test.cpp (original)
+++ trunk/libs/interprocess/test/node_pool_test.cpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -7,16 +7,16 @@
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-
+/*
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/managed_shared_memory.hpp>
#include <boost/interprocess/allocators/detail/node_pool.hpp>
#include <boost/interprocess/smart_ptr/unique_ptr.hpp>
-#include <boost/interprocess/smart_ptr/segment_deleter.hpp>
+#include <boost/interprocess/smart_ptr/deleter.hpp>
#include <vector>
#include <cstddef>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
@@ -134,11 +134,11 @@
<segment_manager, NodeSize, NodesPerChunk> node_pool_t;
typedef test_node_pool<node_pool_t> test_node_pool_t;
- shared_memory_object::remove(test::get_compiler_name());
+ shared_memory_object::remove(test::get_process_id_name());
{
- managed_shared_memory shm(create_only, test::get_compiler_name(), 4096);
+ managed_shared_memory shm(create_only, test::get_process_id_name(), 4096);
- typedef segment_deleter<segment_manager, void*> deleter_t;
+ typedef deleter<node_pool_t, segment_manager> deleter_t;
typedef unique_ptr<node_pool_t, deleter_t> unique_ptr_t;
//Delete the pool when the tests end
@@ -152,7 +152,7 @@
if(!test_node_pool_t::deallocate_free_chunks(*p))
return false;
}
- shared_memory_object::remove(test::get_compiler_name());
+ shared_memory_object::remove(test::get_process_id_name());
return true;
}
@@ -165,3 +165,13 @@
}
#include <boost/interprocess/detail/config_end.hpp>
+*/
+
+#include<stdlib.h>
+
+int main()
+{
+ void *addr = malloc(100);
+ free(addr);
+ return 0;
+}
\ No newline at end of file
Modified: trunk/libs/interprocess/test/null_index_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/null_index_test.cpp (original)
+++ trunk/libs/interprocess/test/null_index_test.cpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -15,7 +15,7 @@
#include <cstddef>
#include <assert.h>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
typedef basic_managed_shared_memory
@@ -25,11 +25,11 @@
int main ()
{
//Create shared memory
- shared_memory_object::remove(test::get_compiler_name());
+ shared_memory_object::remove(test::get_process_id_name());
{
my_shared_objects_t segment
(create_only,
- test::get_compiler_name(), //segment name
+ test::get_process_id_name(), //segment name
65536); //segment size in bytes
//Allocate a portion of the segment
@@ -44,7 +44,7 @@
segment.deallocate(shptr);
}
- shared_memory_object::remove(test::get_compiler_name());
+ shared_memory_object::remove(test::get_process_id_name());
return 0;
}
Modified: trunk/libs/interprocess/test/set_test.hpp
==============================================================================
--- trunk/libs/interprocess/test/set_test.hpp (original)
+++ trunk/libs/interprocess/test/set_test.hpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -19,7 +19,7 @@
#include "print_container.hpp"
#include <boost/interprocess/detail/move_iterator.hpp>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
namespace boost{
namespace interprocess{
@@ -34,7 +34,7 @@
{
typedef typename MyShmSet::value_type IntType;
const int memsize = 65536;
- const char *const shMemName = test::get_compiler_name();
+ const char *const shMemName = test::get_process_id_name();
const int max = 100;
try{
@@ -90,8 +90,14 @@
, std::less<IntType>(), segment.get_segment_manager());
MyStdMultiSet *stdmultiset2 = new MyStdMultiSet(aux_vect2, aux_vect2 + 50);
- if(!CheckEqualContainers(shmset2, stdset2)) return 1;
- if(!CheckEqualContainers(shmmultiset2, stdmultiset2)) return 1;
+ if(!CheckEqualContainers(shmset2, stdset2)){
+ std::cout << "Error in construct<MyShmSet>(MyShmSet2)" << std::endl;
+ return 1;
+ }
+ if(!CheckEqualContainers(shmmultiset2, stdmultiset2)){
+ std::cout << "Error in construct<MyShmMultiSet>(MyShmMultiSet2)" << std::endl;
+ return 1;
+ }
segment.destroy_ptr(shmset2);
segment.destroy_ptr(shmmultiset2);
delete stdset2;
@@ -104,13 +110,19 @@
shmset->insert(move(move_me));
stdset->insert(i);
IntType move_me2(i);
- if(i == 9)
- i = i;
shmmultiset->insert(move(move_me2));
stdmultiset->insert(i);
}
- if(!CheckEqualContainers(shmmultiset, stdmultiset)) return 1;
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->insert(move(move_me)" << std::endl;
+ return 1;
+ }
+
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->insert(move(move_me)" << std::endl;
+ return 1;
+ }
typename MyShmSet::iterator it;
typename MyShmSet::const_iterator cit = it;
@@ -119,15 +131,27 @@
stdset->erase(stdset->begin()++);
shmmultiset->erase(shmmultiset->begin()++);
stdmultiset->erase(stdmultiset->begin()++);
- if(!CheckEqualContainers(shmset, stdset)) return 1;
- if(!CheckEqualContainers(shmmultiset, stdmultiset)) return 1;
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->erase(shmset->begin()++)" << std::endl;
+ return 1;
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->erase(shmmultiset->begin()++)" << std::endl;
+ return 1;
+ }
shmset->erase(shmset->begin());
stdset->erase(stdset->begin());
shmmultiset->erase(shmmultiset->begin());
stdmultiset->erase(stdmultiset->begin());
- if(!CheckEqualContainers(shmset, stdset)) return 1;
- if(!CheckEqualContainers(shmmultiset, stdmultiset)) return 1;
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->erase(shmset->begin())" << std::endl;
+ return 1;
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->erase(shmmultiset->begin())" << std::endl;
+ return 1;
+ }
//Swapping test
std::less<IntType> lessfunc;
@@ -143,8 +167,14 @@
stdset->swap(tmpstdset2);
shmmultiset->swap(tmpshmemultiset2);
stdmultiset->swap(tmpstdmultiset2);
- if(!CheckEqualContainers(shmset, stdset)) return 1;
- if(!CheckEqualContainers(shmmultiset, stdmultiset)) return 1;
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->swap(tmpshmeset2)" << std::endl;
+ return 1;
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->swap(tmpshmemultiset2)" << std::endl;
+ return 1;
+ }
//Insertion from other container
//Initialize values
@@ -168,8 +198,14 @@
stdset->insert(aux_vect2, aux_vect2 + 50);
shmmultiset->insert(detail::make_move_iterator(&aux_vect3[0]), detail::make_move_iterator(aux_vect3 + 50));
stdmultiset->insert(aux_vect2, aux_vect2 + 50);
- if(!CheckEqualContainers(shmset, stdset)) return 1;
- if(!CheckEqualContainers(shmmultiset, stdmultiset)) return 1;
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->insert(detail::make_move_iterator(&aux_vect[0])..." << std::endl;
+ return 1;
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->insert(detail::make_move_iterator(&aux_vect3[0]), ..." << std::endl;
+ return 1;
+ }
for(int i = 0, j = static_cast<int>(shmset->size()); i < j; ++i){
IntType erase_me(i);
@@ -177,9 +213,15 @@
stdset->erase(i);
shmmultiset->erase(erase_me);
stdmultiset->erase(i);
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->erase(erase_me)" << shmset->size() << " " << stdset->size() << std::endl;
+ return 1;
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->erase(erase_me)" << std::endl;
+ return 1;
+ }
}
- if(!CheckEqualContainers(shmset, stdset)) return 1;
- if(!CheckEqualContainers(shmmultiset, stdmultiset)) return 1;
}
{
IntType aux_vect[50];
@@ -217,15 +259,27 @@
shmmultiset->insert(detail::make_move_iterator(&aux_vect5[0]), detail::make_move_iterator(aux_vect5 + 50));
stdmultiset->insert(aux_vect2, aux_vect2 + 50);
stdmultiset->insert(aux_vect2, aux_vect2 + 50);
- if(!CheckEqualContainers(shmset, stdset)) return 1;
- if(!CheckEqualContainers(shmmultiset, stdmultiset)) return 1;
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->insert(detail::make_move_iterator(&aux_vect3[0])..." << std::endl;
+ return 1;
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->insert(detail::make_move_iterator(&aux_vect5[0])..." << std::endl;
+ return 1;
+ }
shmset->erase(*shmset->begin());
stdset->erase(*stdset->begin());
shmmultiset->erase(*shmmultiset->begin());
stdmultiset->erase(*stdmultiset->begin());
- if(!CheckEqualContainers(shmset, stdset)) return 1;
- if(!CheckEqualContainers(shmmultiset, stdmultiset)) return 1;
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->erase(*shmset->begin())" << std::endl;
+ return 1;
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->erase(*shmmultiset->begin())" << std::endl;
+ return 1;
+ }
}
for(i = 0; i < max; ++i){
@@ -237,8 +291,14 @@
stdmultiset->insert(i);
}
- if(!CheckEqualContainers(shmset, stdset)) return 1;
- if(!CheckEqualContainers(shmmultiset, stdmultiset)) return 1;
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->insert(move(move_me)) try 2" << std::endl;
+ return 1;
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->insert(move(move_me2)) try 2" << std::endl;
+ return 1;
+ }
for(i = 0; i < max; ++i){
IntType move_me(i);
@@ -249,10 +309,14 @@
shmmultiset->insert(shmmultiset->begin(), move(move_me2));
stdmultiset->insert(stdmultiset->begin(), i);
//PrintContainers(shmmultiset, stdmultiset);
- if(!CheckEqualContainers(shmset, stdset))
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->insert(shmset->begin(), move(move_me))" << std::endl;
return 1;
- if(!CheckEqualContainers(shmmultiset, stdmultiset))
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->insert(shmmultiset->begin(), move(move_me2))" << std::endl;
return 1;
+ }
IntType move_me3(i);
shmset->insert(shmset->end(), move(move_me3));
@@ -260,10 +324,14 @@
IntType move_me4(i);
shmmultiset->insert(shmmultiset->end(), move(move_me4));
stdmultiset->insert(stdmultiset->end(), i);
- if(!CheckEqualContainers(shmset, stdset))
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->insert(shmset->end(), move(move_me3))" << std::endl;
return 1;
- if(!CheckEqualContainers(shmmultiset, stdmultiset))
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->insert(shmmultiset->end(), move(move_me4))" << std::endl;
return 1;
+ }
{
IntType move_me(i);
shmset->insert(shmset->upper_bound(move_me), move(move_me));
@@ -273,10 +341,14 @@
shmmultiset->insert(shmmultiset->upper_bound(move_me2), move(move_me2));
stdmultiset->insert(stdmultiset->upper_bound(i), i);
//PrintContainers(shmmultiset, stdmultiset);
- if(!CheckEqualContainers(shmset, stdset))
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->insert(shmset->upper_bound(move_me), move(move_me))" << std::endl;
return 1;
- if(!CheckEqualContainers(shmmultiset, stdmultiset))
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->insert(shmmultiset->upper_bound(move_me2), move(move_me2))" << std::endl;
return 1;
+ }
}
{
@@ -288,11 +360,15 @@
shmmultiset->insert(shmmultiset->lower_bound(move_me2), move(move_me2));
stdmultiset->insert(stdmultiset->lower_bound(i), i);
//PrintContainers(shmmultiset, stdmultiset);
- if(!CheckEqualContainers(shmset, stdset))
+ if(!CheckEqualContainers(shmset, stdset)){
+ std::cout << "Error in shmset->insert(shmset->lower_bound(move_me), move(move_me2))" << std::endl;
return 1;
- if(!CheckEqualContainers(shmmultiset, stdmultiset))
+ }
+ if(!CheckEqualContainers(shmmultiset, stdmultiset)){
+ std::cout << "Error in shmmultiset->insert(shmmultiset->lower_bound(move_me2), move(move_me2))" << std::endl;
return 1;
}
+ }
}
//Compare count with std containers
@@ -317,10 +393,14 @@
IntType move_me2(i);
shmmultiset->insert(move(move_me2));
IntType count_me(i);
- if(shmset->count(count_me) != typename MyShmMultiSet::size_type(1))
+ if(shmset->count(count_me) != typename MyShmMultiSet::size_type(1)){
+ std::cout << "Error in shmset->count(count_me)" << std::endl;
return 1;
- if(shmmultiset->count(count_me) != typename MyShmMultiSet::size_type(j+1))
+ }
+ if(shmmultiset->count(count_me) != typename MyShmMultiSet::size_type(j+1)){
+ std::cout << "Error in shmmultiset->count(count_me)" << std::endl;
return 1;
+ }
}
segment.template destroy<MyShmSet>("MyShmSet");
@@ -329,8 +409,10 @@
delete stdmultiset;
segment.shrink_to_fit_indexes();
- if(!segment.all_memory_deallocated())
+ if(!segment.all_memory_deallocated()){
+ std::cout << "Error in segment.all_memory_deallocated()" << std::endl;
return 1;
+ }
}
catch(...){
shared_memory_object::remove(shMemName);
@@ -349,7 +431,7 @@
{
typedef typename MyShmSet::value_type IntType;
const int memsize = 65536;
- const char *const shMemName = test::get_compiler_name();
+ const char *const shMemName = test::get_process_id_name();
const int max = 100;
try{
@@ -389,22 +471,26 @@
//Now, test copy constructor
MyShmSet shmsetcopy(*shmset);
MyStdSet stdsetcopy(*stdset);
- MyShmMultiSet shmmsetcopy(*shmmultiset);
- MyStdMultiSet stdmsetcopy(*stdmultiset);
if(!CheckEqualContainers(&shmsetcopy, &stdsetcopy))
return 1;
+
+ MyShmMultiSet shmmsetcopy(*shmmultiset);
+ MyStdMultiSet stdmsetcopy(*stdmultiset);
+
if(!CheckEqualContainers(&shmmsetcopy, &stdmsetcopy))
return 1;
//And now assignment
shmsetcopy = *shmset;
stdsetcopy = *stdset;
+
+ if(!CheckEqualContainers(&shmsetcopy, &stdsetcopy))
+ return 1;
+
shmmsetcopy = *shmmultiset;
stdmsetcopy = *stdmultiset;
- if(!CheckEqualContainers(&shmsetcopy, &stdsetcopy))
- return 1;
if(!CheckEqualContainers(&shmmsetcopy, &stdmsetcopy))
return 1;
}
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 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -14,7 +14,7 @@
#include <boost/interprocess/shared_memory_object.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
@@ -24,16 +24,16 @@
const std::size_t FileSize = 99999*2;
{
//Remove shared memory
- shared_memory_object::remove(test::get_compiler_name());
+ shared_memory_object::remove(test::get_process_id_name());
//Create shared memory and file mapping
- shared_memory_object mapping(create_only, test::get_compiler_name(), read_write);
+ shared_memory_object mapping(create_only, test::get_process_id_name(), read_write);
mapping.truncate(FileSize);
}
{
//Create a file mapping
- shared_memory_object mapping(open_only, test::get_compiler_name(), read_write);
+ shared_memory_object mapping(open_only, test::get_process_id_name(), read_write);
//Create two mapped regions, one half of the file each
mapped_region region (mapping
@@ -67,7 +67,7 @@
//See if the pattern is correct in the file using two mapped regions
{
//Create a file mapping
- shared_memory_object mapping(open_only, test::get_compiler_name(), read_write);
+ shared_memory_object mapping(open_only, test::get_process_id_name(), read_write);
mapped_region region(mapping, read_write, 0, FileSize/2, 0);
mapped_region region2(mapping, read_write, FileSize/2, 0/*FileSize - FileSize/2*/, 0);
@@ -97,7 +97,7 @@
//Now check the pattern mapping a single read only mapped_region
{
//Create a file mapping
- shared_memory_object mapping(open_only, test::get_compiler_name(), read_only);
+ shared_memory_object mapping(open_only, test::get_process_id_name(), read_only);
//Create a single regions, mapping all the file
mapped_region region (mapping
@@ -115,10 +115,10 @@
}
}
catch(std::exception &exc){
- shared_memory_object::remove(test::get_compiler_name());
+ shared_memory_object::remove(test::get_process_id_name());
std::cout << "Unhandled exception: " << exc.what() << std::endl;
}
- shared_memory_object::remove(test::get_compiler_name());
+ shared_memory_object::remove(test::get_process_id_name());
return 0;
}
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 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -16,12 +16,12 @@
#include <cstring> //for strcmp, memset
#include <iostream> //for cout
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
static const std::size_t ShmSize = 1000;
-static const char * ShmName = test::get_compiler_name();
+static const char * ShmName = test::get_process_id_name();
struct eraser
{
Modified: trunk/libs/interprocess/test/shared_ptr_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/shared_ptr_test.cpp (original)
+++ trunk/libs/interprocess/test/shared_ptr_test.cpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -1,16 +1,14 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Peter Dimov 2002-2005.
-// (C) Copyright Ion Gaztanaga 2006. 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)
+// (C) Copyright Ion Gaztanaga 2006-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.
//
//////////////////////////////////////////////////////////////////////////////
-#ifdef _MSC_VER
-#pragma warning (disable : 4503)
-#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/offset_ptr.hpp>
@@ -22,10 +20,11 @@
#include <boost/interprocess/containers/string.hpp>
#include <boost/interprocess/containers/vector.hpp>
#include <boost/interprocess/detail/utilities.hpp>
+#include <boost/interprocess/smart_ptr/deleter.hpp>
#include <boost/interprocess/smart_ptr/scoped_ptr.hpp>
#include <boost/detail/lightweight_test.hpp>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
@@ -53,12 +52,12 @@
typedef shared_ptr<base_class, base_class_allocator, base_deleter_t> base_shared_ptr;
typedef weak_ptr<base_class, base_class_allocator, base_deleter_t> base_weak_ptr;
- std::string compiler_name;
- test::get_compiler_name(compiler_name);
+ std::string process_name;
+ test::get_process_id_name(process_name);
- shared_memory_object::remove(compiler_name.c_str());
+ shared_memory_object::remove(process_name.c_str());
{
- managed_shared_memory shmem(create_only, compiler_name.c_str(), 10000);
+ managed_shared_memory shmem(create_only, process_name.c_str(), 10000);
{
base_shared_ptr s_ptr(base_shared_ptr::pointer(0),
@@ -90,7 +89,7 @@
//}
}
}
- shared_memory_object::remove(compiler_name.c_str());
+ shared_memory_object::remove(process_name.c_str());
return 0;
}
@@ -134,13 +133,13 @@
typedef vector<string_weak_ptr_t, string_weak_ptr_allocator_t>
string_weak_ptr_vector_t;
- std::string compiler_name;
- test::get_compiler_name(compiler_name);
+ std::string process_name;
+ test::get_process_id_name(process_name);
//A shared memory managed memory classes
- shared_memory_object::remove(compiler_name.c_str());
+ shared_memory_object::remove(process_name.c_str());
{
- managed_shared_memory shmem(create_only, compiler_name.c_str(), 20000);
+ managed_shared_memory shmem(create_only, process_name.c_str(), 20000);
{
const int NumElements = 100;
@@ -256,7 +255,7 @@
string_weak_ptr.reset();
}
}
- shared_memory_object::remove(compiler_name.c_str());
+ shared_memory_object::remove(process_name.c_str());
return 0;
}
//
@@ -416,12 +415,12 @@
typedef weak_ptr<Y, v_allocator_t, y_deleter_t> y_weak_ptr;
- std::string compiler_name;
- test::get_compiler_name(compiler_name);
+ std::string process_name;
+ test::get_process_id_name(process_name);
- shared_memory_object::remove(compiler_name.c_str());
+ shared_memory_object::remove(process_name.c_str());
{
- managed_shared_memory shmem(create_only, compiler_name.c_str(), 10000);
+ managed_shared_memory shmem(create_only, process_name.c_str(), 10000);
{
v_allocator_t v_allocator (shmem.get_segment_manager());
x_deleter_t x_deleter (shmem.get_segment_manager());
@@ -534,7 +533,7 @@
BOOST_TEST(cnt == 0);
}
- shared_memory_object::remove(compiler_name.c_str());
+ shared_memory_object::remove(process_name.c_str());
return boost::report_errors();
}
Modified: trunk/libs/interprocess/test/string_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/string_test.cpp (original)
+++ trunk/libs/interprocess/test/string_test.cpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -26,7 +26,7 @@
#include "expand_bwd_test_allocator.hpp"
#include "expand_bwd_test_template.hpp"
#include "allocator_v1.hpp"
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
@@ -79,16 +79,16 @@
const int MaxSize = 100;
- std::string compiler_name;
- test::get_compiler_name(compiler_name);
+ std::string process_name;
+ test::get_process_id_name(process_name);
//Create shared memory
- shared_memory_object::remove(compiler_name.c_str());
+ shared_memory_object::remove(process_name.c_str());
{
managed_shared_memory segment
(create_only,
- compiler_name.c_str(),//segment name
- 65536); //segment size in bytes
+ process_name.c_str(),//segment name
+ 65536); //segment size in bytes
ShmemAllocatorChar shmallocator (segment.get_segment_manager());
@@ -264,7 +264,7 @@
segment.destroy_ptr(shmStringVect);
delete stdStringVect;
}
- shared_memory_object::remove(compiler_name.c_str());
+ shared_memory_object::remove(process_name.c_str());
return 0;
}
Modified: trunk/libs/interprocess/test/tree_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/tree_test.cpp (original)
+++ trunk/libs/interprocess/test/tree_test.cpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -61,7 +61,7 @@
//Customize managed_shared_memory class
typedef basic_managed_shared_memory
<char,
- simple_seq_fit<mutex_family>,
+ simple_seq_fit<mutex_family, void*>,
map_index
> my_managed_shared_memory;
Modified: trunk/libs/interprocess/test/unique_ptr_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/unique_ptr_test.cpp (original)
+++ trunk/libs/interprocess/test/unique_ptr_test.cpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -7,9 +7,6 @@
// See http://www.boost.org/libs/interprocess for documentation.
//
//////////////////////////////////////////////////////////////////////////////
-#ifdef _MSC_VER
-#pragma warning (disable : 4503)
-#endif
#include <boost/interprocess/detail/config_begin.hpp>
#include <boost/interprocess/offset_ptr.hpp>
@@ -20,10 +17,10 @@
#include <boost/interprocess/containers/set.hpp>
#include <boost/interprocess/containers/vector.hpp>
#include <boost/interprocess/containers/string.hpp>
-#include <boost/interprocess/containers/string.hpp>
+#include <boost/interprocess/smart_ptr/deleter.hpp>
#include <stdio.h>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
@@ -34,24 +31,8 @@
{}
};
-//Deleter. Takes a pointer to the segment manager which
-//has a function to delete the object from the shared memory
-//segment.
-struct MyDeleter
-{
- typedef offset_ptr<MyClass> pointer;
-
- MyDeleter(managed_shared_memory::segment_manager *mngr)
- : m_mngr(mngr)
- {}
-
- void operator()(pointer ptr)
- { m_mngr->destroy_ptr(ptr.get()); }
-
- offset_ptr<managed_shared_memory::segment_manager> m_mngr;
-};
-
-typedef unique_ptr<MyClass, MyDeleter> my_unique_ptr_class;
+typedef deleter<MyClass, managed_shared_memory::segment_manager> my_deleter_type;
+typedef unique_ptr<MyClass, my_deleter_type> my_unique_ptr_class;
typedef set <my_unique_ptr_class
,std::less<my_unique_ptr_class>
,allocator <my_unique_ptr_class
@@ -70,26 +51,26 @@
int main()
{
- std::string compiler_name;
- test::get_compiler_name(compiler_name);
+ std::string process_name;
+ test::get_process_id_name(process_name);
//Create managed shared memory
- shared_memory_object::remove(compiler_name.c_str());
+ shared_memory_object::remove(process_name.c_str());
{
- managed_shared_memory segment(create_only, compiler_name.c_str(), 10000);
-
+ managed_shared_memory segment(create_only, process_name.c_str(), 10000);
+ my_deleter_type my_deleter(segment.get_segment_manager());
//Create unique_ptr using dynamic allocation
my_unique_ptr_class my_ptr (segment.construct<MyClass>(anonymous_instance)()
- ,segment.get_segment_manager());
+ ,my_deleter);
my_unique_ptr_class my_ptr2(segment.construct<MyClass>(anonymous_instance)()
- ,segment.get_segment_manager());
+ ,my_deleter);
//Backup relative pointers to future tests
offset_ptr<MyClass> ptr1 = my_ptr.get();
offset_ptr<MyClass> ptr2 = my_ptr2.get();
//Test some copy constructors
- my_unique_ptr_class my_ptr3(0, segment.get_segment_manager());
+ my_unique_ptr_class my_ptr3(0, my_deleter);
my_unique_ptr_class my_ptr4(move(my_ptr3));
//Construct a list and fill
@@ -134,9 +115,6 @@
assert(set.rbegin()->get() == ptr1);
assert(set.begin()->get() == ptr2);
}
- //MySet set2(move(set));
- //set2.swap(move(MySet(set_less_t(), segment.get_segment_manager())));
- //set.swap(move(MySet(set_less_t(), segment.get_segment_manager())));
//Now with vector
MyVector vector(segment.get_segment_manager());
@@ -162,8 +140,11 @@
assert(vector.begin()->get() == ptr1);
assert(vector.rbegin()->get() == ptr2);
+
+ my_unique_ptr_class a(0, my_deleter), b(0, my_deleter);
+ a = move(b);
}
- shared_memory_object::remove(compiler_name.c_str());
+ shared_memory_object::remove(process_name.c_str());
return 0;
}
Modified: trunk/libs/interprocess/test/vector_test.cpp
==============================================================================
--- trunk/libs/interprocess/test/vector_test.cpp (original)
+++ trunk/libs/interprocess/test/vector_test.cpp 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -31,7 +31,7 @@
#include "expand_bwd_test_template.hpp"
#include "dummy_test_allocator.hpp"
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
@@ -101,11 +101,11 @@
typedef vector<IntType, shmem_allocator_t> MyShmVector;
typedef std::vector<int> MyStdVector;
- std::string compiler_name;
- test::get_compiler_name(compiler_name);
+ std::string process_name;
+ test::get_process_id_name(process_name);
const int Memsize = 65536;
- const char *const shMemName = compiler_name.c_str();
+ const char *const shMemName = process_name.c_str();
const int max = 100;
{
@@ -240,21 +240,33 @@
bool test_expand_bwd()
{
//Now test all back insertion possibilities
- typedef test::expand_bwd_test_allocator<test::int_holder>
+
+ //First raw ints
+ typedef test::expand_bwd_test_allocator<int>
int_allocator_type;
- typedef vector<test::int_holder, int_allocator_type>
+ typedef vector<int, int_allocator_type>
int_vector;
if(!test::test_all_expand_bwd<int_vector>())
return false;
+ //Now user defined wrapped int
+ typedef test::expand_bwd_test_allocator<test::int_holder>
+ int_holder_allocator_type;
+ typedef vector<test::int_holder, int_holder_allocator_type>
+ int_holder_vector;
+
+ if(!test::test_all_expand_bwd<int_holder_vector>())
+ return false;
+
+ //Now user defined bigger wrapped int
typedef test::expand_bwd_test_allocator<test::triple_int_holder>
- triple_allocator_type;
+ triple_int_holder_allocator_type;
- typedef vector<test::triple_int_holder, triple_allocator_type>
- triple_int_vector;
+ typedef vector<test::triple_int_holder, triple_int_holder_allocator_type>
+ triple_int_holder_vector;
- if(!test::test_all_expand_bwd<triple_int_vector>())
+ if(!test::test_all_expand_bwd<triple_int_holder_vector>())
return false;
return true;
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 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -17,23 +17,23 @@
#include <boost/interprocess/windows_shared_memory.hpp>
#include <boost/interprocess/mapped_region.hpp>
#include <string>
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
int main ()
{
- std::string compiler_name;
- test::get_compiler_name(compiler_name);
+ std::string process_name;
+ test::get_process_id_name(process_name);
try{
const std::size_t FileSize = 99999*2;
//Create shared memory and file mapping
- windows_shared_memory mapping(create_only, compiler_name.c_str(), read_write, FileSize);
+ windows_shared_memory mapping(create_only, process_name.c_str(), read_write, FileSize);
{
//Create a file mapping
- windows_shared_memory mapping(open_only, compiler_name.c_str(), read_write);
+ windows_shared_memory mapping(open_only, process_name.c_str(), read_write);
//Create two mapped regions, one half of the file each
mapped_region region (mapping
@@ -67,7 +67,7 @@
//See if the pattern is correct in the file using two mapped regions
{
//Create a file mapping
- windows_shared_memory mapping(open_only, compiler_name.c_str(), read_write);
+ windows_shared_memory mapping(open_only, process_name.c_str(), read_write);
mapped_region region(mapping, read_write, 0, FileSize/2, 0);
mapped_region region2(mapping, read_write, FileSize/2, 0/*FileSize - FileSize/2*/, 0);
@@ -97,7 +97,7 @@
//Now check the pattern mapping a single read only mapped_region
{
//Create a file mapping
- windows_shared_memory mapping(open_only, compiler_name.c_str(), read_only);
+ windows_shared_memory mapping(open_only, process_name.c_str(), read_only);
//Create a single regions, mapping all the file
mapped_region region (mapping
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 2007-08-25 15:10:12 EDT (Sat, 25 Aug 2007)
@@ -20,15 +20,15 @@
#include <cstring> //for strcmp, memset
#include <iostream> //for cout
#include <string> //for string
-#include "get_compiler_name.hpp"
+#include "get_process_id_name.hpp"
using namespace boost::interprocess;
static const char *name_initialization_routine()
{
- static std::string compiler_name;
- test::get_compiler_name(compiler_name);
- return compiler_name.c_str();
+ static std::string process_name;
+ test::get_process_id_name(process_name);
+ return process_name.c_str();
}
static const std::size_t ShmSize = 1000;
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