mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 04:12:13 +00:00
Fixed C++0x and MacOS X bugs
[SVN r52416]
This commit is contained in:
@@ -11,6 +11,9 @@
|
||||
//[doc_managed_allocation_command
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <cassert>
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -19,13 +22,30 @@ int main()
|
||||
//Remove shared memory on construction and destruction
|
||||
struct shm_remove
|
||||
{
|
||||
//<-
|
||||
#if 1
|
||||
shm_remove() { shared_memory_object::remove(test::get_process_id_name()); }
|
||||
~shm_remove(){ shared_memory_object::remove(test::get_process_id_name()); }
|
||||
#else
|
||||
//->
|
||||
shm_remove() { shared_memory_object::remove("MySharedMemory"); }
|
||||
~shm_remove(){ shared_memory_object::remove("MySharedMemory"); }
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
} remover;
|
||||
|
||||
//Managed memory segment that allocates portions of a shared memory
|
||||
//segment with the default management algorithm
|
||||
//<-
|
||||
#if 1
|
||||
managed_shared_memory managed_shm(create_only, test::get_process_id_name(), 10000*sizeof(std::size_t));
|
||||
#else
|
||||
//->
|
||||
managed_shared_memory managed_shm(create_only, "MySharedMemory", 10000*sizeof(std::size_t));
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
|
||||
//Allocate at least 100 bytes, 1000 bytes if possible
|
||||
std::size_t received_size, min_size = 100, preferred_size = 1000;
|
||||
|
||||
Reference in New Issue
Block a user