]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/interprocess/test/anonymous_shared_memory_test.cpp
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 //////////////////////////////////////////////////////////////////////////////
12 #include <boost/interprocess/mapped_region.hpp>
13 #include <boost/interprocess/anonymous_shared_memory.hpp>
17 using namespace boost::interprocess
;
22 const std::size_t MemSize
= 99999*2;
24 //Now check anonymous mapping
25 mapped_region
region(anonymous_shared_memory(MemSize
));
28 unsigned char *pattern
= static_cast<unsigned char*>(region
.get_address());
32 *pattern
= static_cast<unsigned char>(i
);
36 pattern
= static_cast<unsigned char*>(region
.get_address());
40 if(*pattern
!= static_cast<unsigned char>(i
)){
46 catch(std::exception
&exc
){
47 std::cout
<< "Unhandled exception: " << exc
.what() << std::endl
;