mirror of
https://github.com/boostorg/interprocess.git
synced 2026-01-19 16:22:19 +00:00
Simplify doc_/comp_ examples using quickbook macros instead of in-code #ifdefs.
This commit is contained in:
@@ -26,34 +26,15 @@ 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;
|
||||
//<-
|
||||
(void)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;
|
||||
|
||||
Reference in New Issue
Block a user