Boost C++ Libraries Home Libraries People FAQ More

PrevUpHomeNext

Class xsi_shared_memory

boost::interprocess::xsi_shared_memory

Synopsis

// 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(create_only_t, const xsi_key &, std::size_t, 
                    const permissions & = permissions());
  xsi_shared_memory(open_or_create_t, const xsi_key &, std::size_t, 
                    const permissions & = permissions());
  xsi_shared_memory(open_only_t, const xsi_key &);
  xsi_shared_memory(xsi_shared_memory &&);
  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);
};

Description

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/destruct

  1. xsi_shared_memory();

    Default constructor. Represents an empty xsi_shared_memory.

  2. 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.

  3. xsi_shared_memory(create_only_t, const xsi_key & key, std::size_t size, 
                      const permissions & perm = permissions());

    Creates a new XSI shared memory from 'key', with size "size" and permissions "perm". If the shared memory previously exists, throws an error.

  4. xsi_shared_memory(open_or_create_t, const xsi_key & key, std::size_t size, 
                      const permissions & perm = permissions());

    Opens an existing shared memory with identifier 'key' or creates a new XSI shared memory from identifier 'key', with size "size" and permissions "perm".

  5. xsi_shared_memory(open_only_t, const xsi_key & key);

    Tries to open a XSI shared memory with identifier 'key' If the shared memory does not previously exist, it throws an error.

  6. xsi_shared_memory(xsi_shared_memory && moved);

    Moves the ownership of "moved"'s shared memory object to *this. After the call, "moved" does not represent any shared memory object. Does not throw

  7. 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

  8. ~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 functions

  1. void swap(xsi_shared_memory & other);
    Swaps two xsi_shared_memorys. Does not throw.
  2. int get_shmid() const;

    Returns the shared memory ID that identifies the shared memory

  3. mapping_handle_t get_mapping_handle() const;

    Returns the mapping handle. Never throws

xsi_shared_memory public static functions

  1. static bool remove(int shmid);

    Erases the XSI shared memory object identified by shmid from the system. Returns false on error. Never throws


PrevUpHomeNext