mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
Trailing spaces and Phoenix singleton for intermodule_singleton
[SVN r78515]
This commit is contained in:
@@ -31,7 +31,7 @@
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
//This test inserts messages with different priority and marks them with a
|
||||
//This test inserts messages with different priority and marks them with a
|
||||
//time-stamp to check if receiver obtains highest priority messages first and
|
||||
//messages with same priority are received in fifo order
|
||||
bool test_priority_order()
|
||||
@@ -43,7 +43,7 @@ bool test_priority_order()
|
||||
mq2
|
||||
(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
|
||||
//We test that the queue is ordered by priority and in the
|
||||
//same priority, is a FIFO
|
||||
message_queue::size_type recvd = 0;
|
||||
unsigned int priority = 0;
|
||||
@@ -78,19 +78,19 @@ bool test_priority_order()
|
||||
}
|
||||
|
||||
//[message_queue_test_test_serialize_db
|
||||
//This test creates a in memory data-base using Interprocess machinery and
|
||||
//serializes it through a message queue. Then rebuilds the data-base in
|
||||
//This test creates a in memory data-base using Interprocess machinery and
|
||||
//serializes it through a message queue. Then rebuilds the data-base in
|
||||
//another buffer and checks it against the original data-base
|
||||
bool test_serialize_db()
|
||||
{
|
||||
//Typedef data to create a Interprocess map
|
||||
//Typedef data to create a Interprocess map
|
||||
typedef std::pair<const std::size_t, std::size_t> MyPair;
|
||||
typedef std::less<std::size_t> MyLess;
|
||||
typedef node_allocator<MyPair, managed_external_buffer::segment_manager>
|
||||
node_allocator_t;
|
||||
typedef map<std::size_t,
|
||||
std::size_t,
|
||||
std::less<std::size_t>,
|
||||
typedef map<std::size_t,
|
||||
std::size_t,
|
||||
std::less<std::size_t>,
|
||||
node_allocator_t>
|
||||
MyMap;
|
||||
|
||||
@@ -114,12 +114,12 @@ bool test_serialize_db()
|
||||
|
||||
//Construct the map in the first buffer
|
||||
MyMap *map1 = db_origin.construct<MyMap>("MyMap")
|
||||
(MyLess(),
|
||||
(MyLess(),
|
||||
db_origin.get_segment_manager());
|
||||
if(!map1)
|
||||
return false;
|
||||
|
||||
//Fill map1 until is full
|
||||
//Fill map1 until is full
|
||||
try{
|
||||
std::size_t i = 0;
|
||||
while(1){
|
||||
@@ -135,11 +135,11 @@ bool test_serialize_db()
|
||||
message_queue::size_type total_recvd = 0;
|
||||
unsigned int priority;
|
||||
|
||||
//Send whole first buffer through the mq1, read it
|
||||
//Send whole first buffer through the mq1, read it
|
||||
//through mq2 to the second buffer
|
||||
while(1){
|
||||
//Send a fragment of buffer1 through mq1
|
||||
std::size_t bytes_to_send = MaxMsgSize < (db_origin.get_size() - sent) ?
|
||||
std::size_t bytes_to_send = MaxMsgSize < (db_origin.get_size() - sent) ?
|
||||
MaxMsgSize : (db_origin.get_size() - sent);
|
||||
mq1.send( &static_cast<char*>(db_origin.get_address())[sent]
|
||||
, bytes_to_send
|
||||
@@ -157,8 +157,8 @@ bool test_serialize_db()
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//The buffer will contain a copy of the original database
|
||||
|
||||
//The buffer will contain a copy of the original database
|
||||
//so let's interpret the buffer with managed_external_buffer
|
||||
managed_external_buffer db_destiny(open_only, &buffer_destiny[0], BufferSize);
|
||||
|
||||
@@ -188,7 +188,7 @@ bool test_serialize_db()
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//Destroy maps from db-s
|
||||
db_origin.destroy_ptr(map1);
|
||||
db_destiny.destroy_ptr(map2);
|
||||
@@ -243,15 +243,15 @@ bool test_buffer_overflow()
|
||||
|
||||
int main ()
|
||||
{
|
||||
if(!test_priority_order()){
|
||||
if(!test_priority_order()){
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!test_serialize_db()){
|
||||
if(!test_serialize_db()){
|
||||
return 1;
|
||||
}
|
||||
|
||||
if(!test_buffer_overflow()){
|
||||
if(!test_buffer_overflow()){
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user