]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/interprocess/test/anonymous_shared_memory_test.cpp
cdff6e66fbb310d8cc5e2edafe1faf189e8e7a65
1 //////////////////////////////////////////////////////////////////////////////
3 // (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost
4 // Software License, Version 1.0. (See accompanying file
5 // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 // See http://www.boost.org/libs/interprocess for documentation.
9 //////////////////////////////////////////////////////////////////////////////
11 #include <boost/interprocess/detail/config_begin.hpp>
13 #include <boost/interprocess/mapped_region.hpp>
14 #include <boost/interprocess/anonymous_shared_memory.hpp>
18 using namespace boost::interprocess
;
23 const std::size_t MemSize
= 99999*2;
25 //Now check anonymous mapping
26 mapped_region
region(anonymous_shared_memory(MemSize
));
29 unsigned char *pattern
= static_cast<unsigned char*>(region
.get_address());
33 *pattern
= static_cast<unsigned char>(i
);
37 pattern
= static_cast<unsigned char*>(region
.get_address());
41 if(*pattern
!= static_cast<unsigned char>(i
)){
47 catch(std::exception
&exc
){
48 std::cout
<< "Unhandled exception: " << exc
.what() << std::endl
;
54 #include <boost/interprocess/detail/config_end.hpp>