...one of the most highly
regarded and expertly designed C++ library projects in the
world.
— Herb Sutter and Andrei
Alexandrescu, C++
Coding Standards
boost::interprocess::xsi_shared_memory
// In header: <boost/interprocess/xsi_shared_memory.hpp> class xsi_shared_memory { public: // construct/copy/destruct xsi_shared_memory(); xsi_shared_memory(open_only_t, int); xsi_shared_memory(open_only_t, const xsi_key &); xsi_shared_memory& operator=(xsi_shared_memory &&); ~xsi_shared_memory(); // public member functions void swap(xsi_shared_memory &); int get_shmid() const; mapping_handle_t get_mapping_handle() const; // public static functions static bool remove(int); // public data members __pad0__; };
A class that wraps XSI (System V) shared memory. Unlike shared_memory_object, xsi_shared_memory needs a valid xsi_key to identify a shared memory object.
Warning: XSI shared memory and interprocess portable shared memory (boost::interprocess::shared_memory_object) can't communicate between them.
xsi_shared_memory
public
construct/copy/destructxsi_shared_memory();
Default constructor. Represents an empty xsi_shared_memory
.
xsi_shared_memory(open_only_t, int shmid);
Initializes *this with a shmid previously obtained (possibly from another process) This lower-level initializer allows shared memory mapping without having a key.
xsi_shared_memory(open_only_t, const xsi_key & key);
Creates a new XSI shared memory from 'key', with size "size" and permissions "perm". If the shared memory previously exists, throws an error. Opens an existing shared memory with identifier 'key' or creates a new XSI shared memory from identifier 'key', with size "size" and permissions "perm". Tries to open a XSI shared memory with identifier 'key' If the shared memory does not previously exist, it throws an error.
xsi_shared_memory& operator=(xsi_shared_memory && moved);
Moves the ownership of "moved"'s shared memory to *this. After the call, "moved" does not represent any shared memory. Does not throw
~xsi_shared_memory();
Destroys *this. The shared memory won't be destroyed, just this connection to it. Use remove() to destroy the shared memory.
xsi_shared_memory
public member functionsvoid swap(xsi_shared_memory & other);Swaps two xsi_shared_memorys. Does not throw.
int get_shmid() const;
Returns the shared memory ID that identifies the shared memory
mapping_handle_t get_mapping_handle() const;
Returns the mapping handle. Never throws