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:
@@ -3058,7 +3058,11 @@ To use a managed shared memory, you must include the following header:
|
||||
// to implement managed features.
|
||||
//!! If anything fails, throws interprocess_exception
|
||||
//
|
||||
managed_shared_memory segment (create_only, "MySharedMemory", //Shared memory object name 65536); //Shared memory object size in bytes
|
||||
managed_shared_memory segment ( create_only
|
||||
, "MySharedMemory" //Shared memory object name
|
||||
, 65536); //Shared memory object size in bytes
|
||||
|
||||
|
||||
[c++]
|
||||
|
||||
//1. Opens a shared memory object
|
||||
@@ -3069,7 +3073,8 @@ To use a managed shared memory, you must include the following header:
|
||||
// to implement managed features.
|
||||
//!! If anything fails, throws interprocess_exception
|
||||
//
|
||||
managed_shared_memory segment (open_only, "MySharedMemory");//Shared memory object name[c++]
|
||||
managed_shared_memory segment (open_only, "MySharedMemory");//Shared memory object name
|
||||
|
||||
|
||||
[c++]
|
||||
|
||||
@@ -3078,7 +3083,11 @@ To use a managed shared memory, you must include the following header:
|
||||
//2. Otherwise, equivalent to "open_only" (size is ignored)
|
||||
//!! If anything fails, throws interprocess_exception
|
||||
//
|
||||
managed_shared_memory segment (open_or_create, "MySharedMemory", //Shared memory object name 65536); //Shared memory object size in bytes
|
||||
managed_shared_memory segment ( open_or_create
|
||||
, "MySharedMemory" //Shared memory object name
|
||||
, 65536); //Shared memory object size in bytes
|
||||
|
||||
|
||||
When the `managed_shared_memory` object is destroyed, the shared memory
|
||||
object is automatically unmapped, and all the resources are freed. To remove
|
||||
the shared memory object from the system you must use the `shared_memory_object::remove`
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/allocators/adaptive_pool.hpp>
|
||||
#include <cassert>
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
@@ -21,14 +24,31 @@ 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;
|
||||
|
||||
//Create shared memory
|
||||
//<-
|
||||
#if 1
|
||||
managed_shared_memory segment(create_only,test::get_process_id_name(), 65536);
|
||||
#else
|
||||
//->
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
|
||||
//Create a adaptive_pool that allocates ints from the managed segment
|
||||
//The number of chunks per segment is the default value
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <cassert>
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
@@ -21,14 +24,31 @@ 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;
|
||||
|
||||
//Create shared memory
|
||||
//<-
|
||||
#if 1
|
||||
managed_shared_memory segment(create_only,test::get_process_id_name(), 65536);
|
||||
#else
|
||||
//->
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
|
||||
//Create an allocator that allocates ints from the managed segment
|
||||
allocator<int, managed_shared_memory::segment_manager>
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
#include <vector>
|
||||
#include <iterator>
|
||||
#include <cstddef>
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
@@ -23,14 +26,31 @@ 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;
|
||||
|
||||
//Create shared memory
|
||||
//<-
|
||||
#if 1
|
||||
managed_shared_memory segment(create_only,test::get_process_id_name(), 65536);
|
||||
#else
|
||||
//->
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
|
||||
//Fill data
|
||||
std::vector<int> data;
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/allocators/cached_adaptive_pool.hpp>
|
||||
#include <cassert>
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
@@ -21,14 +24,31 @@ 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;
|
||||
|
||||
//Create shared memory
|
||||
//<-
|
||||
#if 1
|
||||
managed_shared_memory segment(create_only,test::get_process_id_name(), 65536);
|
||||
#else
|
||||
//->
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
|
||||
//Create a cached_adaptive_pool that allocates ints from the managed segment
|
||||
//The number of chunks per segment is the default value
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/allocators/cached_node_allocator.hpp>
|
||||
#include <cassert>
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
@@ -21,14 +24,31 @@ 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;
|
||||
|
||||
//Create shared memory
|
||||
//<-
|
||||
#if 1
|
||||
managed_shared_memory segment(create_only, test::get_process_id_name(), 65536);
|
||||
#else
|
||||
//->
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
|
||||
//Create a cached_node_allocator that allocates ints from the managed segment
|
||||
//The number of chunks per segment is the default value
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
int main ()
|
||||
{
|
||||
@@ -20,15 +23,32 @@ 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;
|
||||
|
||||
//A managed shared memory where we can construct objects
|
||||
//associated with a c-string
|
||||
//<-
|
||||
#if 1
|
||||
managed_shared_memory segment(create_only,test::get_process_id_name(), 65536);
|
||||
#else
|
||||
//->
|
||||
managed_shared_memory segment(create_only,
|
||||
"MySharedMemory", //segment name
|
||||
65536);
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
|
||||
//Alias an STL-like allocator of ints that allocates ints from the segment
|
||||
typedef allocator<int, managed_shared_memory::segment_manager>
|
||||
|
||||
@@ -13,6 +13,9 @@
|
||||
//[doc_intrusive
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/smart_ptr/intrusive_ptr.hpp>
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
using namespace boost::interprocess;
|
||||
|
||||
@@ -74,12 +77,29 @@ 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;
|
||||
|
||||
//Create shared memory
|
||||
//<-
|
||||
#if 1
|
||||
managed_shared_memory shmem(create_only, test::get_process_id_name(), 10000);
|
||||
#else
|
||||
//->
|
||||
managed_shared_memory shmem(create_only, "MySharedMemory", 10000);
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
|
||||
//Create the unique reference counted object in shared memory
|
||||
N::reference_counted_class *ref_counted =
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[run_ipc_message
|
||||
//[doc_ipc_message
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <cstdlib> //std::system
|
||||
#include <sstream>
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
//[doc_managed_aligned_allocation
|
||||
#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(), 65536);
|
||||
#else
|
||||
//->
|
||||
managed_shared_memory managed_shm(create_only, "MySharedMemory", 65536);
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
|
||||
const std::size_t Alignment = 128;
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <cassert>
|
||||
#include <cstring>
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
class my_class
|
||||
{
|
||||
@@ -25,11 +28,28 @@ 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;
|
||||
|
||||
//<-
|
||||
#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
|
||||
//->
|
||||
|
||||
//Construct objects
|
||||
my_class *named_object = managed_shm.construct<my_class>("Object name")[1]();
|
||||
|
||||
@@ -15,7 +15,9 @@
|
||||
#include <cstring>//std::memset
|
||||
#include <new> //std::nothrow
|
||||
#include <vector> //std::vector
|
||||
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -25,11 +27,28 @@ 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_shared_memory managed_shm(create_only, "MySharedMemory", 65536);
|
||||
//<-
|
||||
#if 1
|
||||
managed_shared_memory managed_shm(create_only,test::get_process_id_name(), 65536);
|
||||
#else
|
||||
//->
|
||||
managed_shared_memory managed_shm(create_only,"MySharedMemory", 65536);
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
|
||||
//Allocate 16 elements of 100 bytes in a single call. Non-throwing version.
|
||||
multiallocation_chain chain(managed_shm.allocate_many(100, 16, std::nothrow));
|
||||
|
||||
@@ -10,6 +10,9 @@
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
//[doc_managed_raw_allocation
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
int main()
|
||||
{
|
||||
@@ -18,13 +21,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
|
||||
managed_shared_memory managed_shm(create_only, "MySharedMemory", 65536);
|
||||
//<-
|
||||
#if 1
|
||||
managed_shared_memory managed_shm(create_only,test::get_process_id_name(), 65536);
|
||||
#else
|
||||
//->
|
||||
managed_shared_memory managed_shm(create_only,"MySharedMemory", 65536);
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
|
||||
//Allocate 100 bytes of memory from segment, throwing version
|
||||
void *ptr = managed_shm.allocate(100);
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <functional>
|
||||
#include <utility>
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
int main ()
|
||||
{
|
||||
@@ -23,17 +26,34 @@ 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;
|
||||
|
||||
//Shared memory front-end that is able to construct objects
|
||||
//associated with a c-string. Erase previous shared memory with the name
|
||||
//to be used and create the memory segment at the specified address and initialize resources
|
||||
//<-
|
||||
#if 1
|
||||
managed_shared_memory segment(create_only,test::get_process_id_name(), 65536);
|
||||
#else
|
||||
//->
|
||||
managed_shared_memory segment
|
||||
(create_only
|
||||
,"MySharedMemory" //segment name
|
||||
,65536); //segment size in bytes
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
|
||||
//Note that map<Key, MappedType>'s value_type is std::pair<const Key, MappedType>,
|
||||
//so the allocator must allocate that pair.
|
||||
|
||||
@@ -15,6 +15,9 @@
|
||||
#include <boost/interprocess/containers/string.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
#include <cassert>
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
int main ()
|
||||
{
|
||||
@@ -31,11 +34,28 @@ 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;
|
||||
|
||||
//<-
|
||||
#if 1
|
||||
managed_shared_memory shm(create_only, test::get_process_id_name(), 65536);
|
||||
#else
|
||||
//->
|
||||
managed_shared_memory shm(create_only, "MySharedMemory", 10000);
|
||||
//<-
|
||||
#endif
|
||||
//->
|
||||
|
||||
//Create allocators
|
||||
CharAllocator charallocator (shm.get_segment_manager());
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
#include <boost/interprocess/detail/config_begin.hpp>
|
||||
#include <boost/interprocess/detail/workaround.hpp>
|
||||
//[run_doc_spawn_vector
|
||||
//[doc_spawn_vector
|
||||
#include <boost/interprocess/managed_shared_memory.hpp>
|
||||
#include <boost/interprocess/containers/vector.hpp>
|
||||
#include <boost/interprocess/allocators/allocator.hpp>
|
||||
|
||||
@@ -17,6 +17,9 @@
|
||||
#include <cstring>
|
||||
#include <cstdlib>
|
||||
#include <string>
|
||||
//<-
|
||||
#include "../test/get_process_id_name.hpp"
|
||||
//->
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user