Main Page   Namespace List   Class Hierarchy   Compound List   File List   Compound Members   File Members  

IPC::Shm Class Reference

System V IPC shared memory. More...

#include <ipcplus.h>

Inheritance diagram for IPC::Shm::

List of all members.

Public Methods

 Shm (const unsigned int key, const size_t size)
 Constructor. More...

virtual ~Shm ()
 Destructor. More...

virtual bool destroy ()
 Destroy the actual IPC shared memory segment. More...


Public Attributes

void * pMem
 A pointer to the attached shared memory segment.


Protected Attributes

int mid
 The Sys V IPC memory id.


Detailed Description

System V IPC shared memory.

This class is intended to be a base class. See the test program for a sample derived class.


Constructor & Destructor Documentation

IPC::Shm::Shm const unsigned int    key,
const size_t    size
 

Constructor.

The constructor simply creates the specified shared memory segment if it doesn't exist or attaches to the existing segment if it does. The pMem member will be NULL if the constructor failed.

Parameters:
key  This is the "name" of the shared memory segment. By using the same value, different processes can obtain access to the same memory. Obviously, some method must be deployed to both insure that this key is unique in the system's shared memory space as well as known to those processes that wish to share the memory. See ftok() for one possible method to determine such a key value.
size  The number of bytes to allocate.

IPC::Shm::~Shm   [virtual]
 

Destructor.

The destructor will only detach the shared memory segment. Use destroy() to de-allocate the shared memory segment.


Member Function Documentation

bool IPC::Shm::destroy   [virtual]
 

Destroy the actual IPC shared memory segment.

Returns:
False if the destroy operation returned an error.


The documentation for this class was generated from the following files:
Generated on Wed May 15 09:33:33 2002 for IPCPlus by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001