New Interprocess version

[SVN r38272]
This commit is contained in:
Ion Gaztañaga
2007-07-22 14:16:59 +00:00
parent 2c2657a933
commit d30380e07d
50 changed files with 2702 additions and 1318 deletions

View File

@@ -20,6 +20,8 @@
#include <limits>
#include <boost/thread.hpp>
#include <memory>
#include <string>
#include "get_compiler_name.hpp"
#ifdef max
#undef max
@@ -38,12 +40,12 @@ using namespace boost::interprocess;
//messages with same priority are received in fifo order
bool test_priority_order()
{
message_queue::remove("test_priority_order");
message_queue::remove(test::get_compiler_name());
{
message_queue mq1
(open_or_create, "test_priority_order", 100, sizeof(std::size_t)),
(open_or_create, test::get_compiler_name(), 100, sizeof(std::size_t)),
mq2
(open_or_create, "test_priority_order", 100, sizeof(std::size_t));
(open_or_create, test::get_compiler_name(), 100, sizeof(std::size_t));
//We test that the queue is ordered by priority and in the
//same priority, is a FIFO
@@ -75,7 +77,7 @@ bool test_priority_order()
tstamp_prev = tstamp;
}
}
message_queue::remove("test_priority_order");
message_queue::remove(test::get_compiler_name());
return true;
}
@@ -103,13 +105,13 @@ bool test_serialize_db()
//Allocate a memory buffer to hold the destiny database using vector<char>
std::vector<char> buffer_destiny(BufferSize, 0);
message_queue::remove("message_queue");
message_queue::remove(test::get_compiler_name());
{
//Create the message-queues
message_queue mq1(create_only, "message_queue", 1, MaxMsgSize);
message_queue mq1(create_only, test::get_compiler_name(), 1, MaxMsgSize);
//Open previously created message-queue simulating other process
message_queue mq2(open_only, "message_queue");
message_queue mq2(open_only, test::get_compiler_name());
//A managed heap memory to create the origin database
managed_heap_memory db_origin(buffer_destiny.size());
@@ -194,7 +196,7 @@ bool test_serialize_db()
db_origin.destroy_ptr(map1);
db_destiny.destroy_ptr(map2);
}
message_queue::remove("message_queue");
message_queue::remove(test::get_compiler_name());
return true;
}
//]
@@ -219,11 +221,11 @@ void receiver()
bool test_buffer_overflow()
{
boost::interprocess::message_queue::remove("mymsg");
boost::interprocess::message_queue::remove(test::get_compiler_name());
{
std::auto_ptr<boost::interprocess::message_queue>
ptr(new boost::interprocess::message_queue
(create_only, "mymsg", 10, 10));
(create_only, test::get_compiler_name(), 10, 10));
pmessage_queue = ptr.get();
//Launch the receiver thread
@@ -238,7 +240,7 @@ bool test_buffer_overflow()
thread.join();
}
boost::interprocess::message_queue::remove("mymsg");
boost::interprocess::message_queue::remove(test::get_compiler_name());
return true;
}