mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
Intrusive:
* Added `linear<>` and `cache_last<>` options to singly linked lists. * Added `optimize_multikey<>` option to unordered container hooks. * Optimized unordered containers when `store_hash` option is used in the hook. * Implementation changed to be exception agnostic so that it can be used in environments without exceptions. * Added `container_from_iterator` function to tree-based containers. Interprocess: * Added anonymous shared memory for UNIX systems. * Fixed file lock compilation errors [SVN r44819]
This commit is contained in:
@@ -13,6 +13,7 @@
|
||||
#include <iostream>
|
||||
#include <boost/interprocess/shared_memory_object.hpp>
|
||||
#include <boost/interprocess/mapped_region.hpp>
|
||||
#include <boost/interprocess/anonymous_shared_memory.hpp>
|
||||
#include <string>
|
||||
#include "get_process_id_name.hpp"
|
||||
|
||||
@@ -113,6 +114,28 @@ int main ()
|
||||
}
|
||||
}
|
||||
}
|
||||
{
|
||||
//Now check anonymous mapping
|
||||
mapped_region region(anonymous_shared_memory(FileSize));
|
||||
|
||||
//Write pattern
|
||||
unsigned char *pattern = static_cast<unsigned char*>(region.get_address());
|
||||
for(std::size_t i = 0
|
||||
;i < FileSize
|
||||
;++i, ++pattern){
|
||||
*pattern = static_cast<unsigned char>(i);
|
||||
}
|
||||
|
||||
//Check pattern
|
||||
pattern = static_cast<unsigned char*>(region.get_address());
|
||||
for(std::size_t i = 0
|
||||
;i < FileSize
|
||||
;++i, ++pattern){
|
||||
if(*pattern != static_cast<unsigned char>(i)){
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch(std::exception &exc){
|
||||
shared_memory_object::remove(test::get_process_id_name());
|
||||
|
||||
Reference in New Issue
Block a user