mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
Merged interprocess from trunk
[SVN r81664]
This commit is contained in:
@@ -49,6 +49,9 @@ int main ()
|
||||
const int NumMsg = 100;
|
||||
|
||||
int extracted_data [NumMsg];
|
||||
//<-
|
||||
(void)extracted_data;
|
||||
//->
|
||||
|
||||
//Extract the data
|
||||
for(int i = 0; i < NumMsg; ++i){
|
||||
|
||||
@@ -25,12 +25,14 @@ int main()
|
||||
//Define file names
|
||||
//<-
|
||||
#if 1
|
||||
std::string managed_file(boost::interprocess::ipcdetail::get_temporary_path());
|
||||
managed_file += "/"; managed_file += test::get_process_id_name();
|
||||
const char *ManagedFile = managed_file.c_str();
|
||||
std::string managed_file2(boost::interprocess::ipcdetail::get_temporary_path());
|
||||
managed_file2 += "/"; managed_file2 += test::get_process_id_name(); managed_file2 += "_2";
|
||||
const char *ManagedFile2 = managed_file2.c_str();
|
||||
const char *ManagedFile = 0;
|
||||
const char *ManagedFile2 = 0;
|
||||
std::string managed_file_name(boost::interprocess::ipcdetail::get_temporary_path());
|
||||
managed_file_name += "/"; managed_file_name += test::get_process_id_name();
|
||||
ManagedFile = managed_file_name.c_str();
|
||||
std::string managed_file2_name(boost::interprocess::ipcdetail::get_temporary_path());
|
||||
managed_file2_name += "/"; managed_file2_name += test::get_process_id_name(); managed_file2_name += "_2";
|
||||
ManagedFile2 = managed_file2_name.c_str();
|
||||
#else
|
||||
//->
|
||||
const char *ManagedFile = "MyManagedFile";
|
||||
|
||||
@@ -54,7 +54,8 @@ int main()
|
||||
//->
|
||||
|
||||
//Allocate 16 elements of 100 bytes in a single call. Non-throwing version.
|
||||
multiallocation_chain chain(managed_shm.allocate_many(100, 16, std::nothrow));
|
||||
multiallocation_chain chain;
|
||||
managed_shm.allocate_many(std::nothrow, 100, 16, chain);
|
||||
|
||||
//Check if the memory allocation was successful
|
||||
if(chain.empty()) return 1;
|
||||
@@ -82,8 +83,8 @@ int main()
|
||||
for(std::size_t i = 0; i < 10; ++i)
|
||||
sizes[i] = i*3;
|
||||
|
||||
chain = managed_shm.allocate_many(sizes, 10);
|
||||
managed_shm.deallocate_many(boost::move(chain));
|
||||
managed_shm.allocate_many(sizes, 10, 1, chain);
|
||||
managed_shm.deallocate_many(chain);
|
||||
return 0;
|
||||
}
|
||||
//]
|
||||
|
||||
@@ -14,10 +14,17 @@
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <boost/interprocess/containers/string.hpp>
|
||||
|
||||
//<-
|
||||
//Shield against external warnings
|
||||
#include <boost/interprocess/detail/config_external_begin.hpp>
|
||||
//->
|
||||
|
||||
#include <boost/multi_index_container.hpp>
|
||||
#include <boost/multi_index/member.hpp>
|
||||
#include <boost/multi_index/ordered_index.hpp>
|
||||
|
||||
//<-
|
||||
#include <boost/interprocess/detail/config_external_end.hpp>
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
|
||||
@@ -13,9 +13,21 @@
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
|
||||
//<-
|
||||
//Shield against external warnings
|
||||
#include <boost/interprocess/detail/config_external_begin.hpp>
|
||||
//->
|
||||
|
||||
#include <boost/unordered_map.hpp> //boost::unordered_map
|
||||
|
||||
//<-
|
||||
#include <boost/interprocess/detail/config_external_end.hpp>
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
#include <functional> //std::equal_to
|
||||
#include <boost/functional/hash.hpp> //boost::hash
|
||||
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
Reference in New Issue
Block a user