mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
#1211: Interprocess tests hang when run in parallel
#1080 boost::interprocess win32 global file mapping issue [SVN r38950]
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
#include <memory>
|
||||
#include <cstdio>
|
||||
#include <string>
|
||||
#include "get_compiler_name.hpp"
|
||||
#include "get_process_id_name.hpp"
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
@@ -26,14 +26,14 @@ int main ()
|
||||
const std::size_t FileSize = 99999*2;
|
||||
{
|
||||
//Create file with given size
|
||||
std::ofstream file(test::get_compiler_name(), std::ios::binary | std::ios::trunc);
|
||||
std::ofstream file(test::get_process_id_name(), std::ios::binary | std::ios::trunc);
|
||||
file.seekp(static_cast<std::streamoff>(FileSize-1));
|
||||
file.write("", 1);
|
||||
}
|
||||
|
||||
{
|
||||
//Create a file mapping
|
||||
file_mapping mapping(test::get_compiler_name(), read_write);
|
||||
file_mapping mapping(test::get_process_id_name(), read_write);
|
||||
//Create two mapped regions, one half of the file each
|
||||
mapped_region region (mapping
|
||||
,read_write
|
||||
@@ -66,7 +66,7 @@ int main ()
|
||||
//See if the pattern is correct in the file
|
||||
{
|
||||
//Open the file
|
||||
std::ifstream file(test::get_compiler_name(), std::ios::binary);
|
||||
std::ifstream file(test::get_process_id_name(), std::ios::binary);
|
||||
|
||||
//Create a memory buffer
|
||||
std::auto_ptr<unsigned char> memory (new unsigned char [FileSize/2 +1]);
|
||||
@@ -103,7 +103,7 @@ int main ()
|
||||
//Now check the pattern mapping a single read only mapped_region
|
||||
{
|
||||
//Create a file mapping
|
||||
file_mapping mapping(test::get_compiler_name(), read_only);
|
||||
file_mapping mapping(test::get_process_id_name(), read_only);
|
||||
|
||||
//Create a single regions, mapping all the file
|
||||
mapped_region region (mapping
|
||||
@@ -122,11 +122,11 @@ int main ()
|
||||
}
|
||||
}
|
||||
catch(std::exception &exc){
|
||||
std::remove(test::get_compiler_name());
|
||||
std::remove(test::get_process_id_name());
|
||||
std::cout << "Unhandled exception: " << exc.what() << std::endl;
|
||||
throw;
|
||||
}
|
||||
std::remove(test::get_compiler_name());
|
||||
std::remove(test::get_process_id_name());
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user