#include <cascade/interprocess/CascadeSharedMemZone.h>
Inheritance diagram for CascadeSharedMemZone:
Public Member Functions | |
CascadeSharedMemZone () | |
virtual | ~CascadeSharedMemZone () |
bool | Open (const char *pName, u32 nNumBytes, bool bCreateIfNecessary) |
bool | Close () |
void * | MapLock () |
bool | Unlock () |
u32 | GetSize () |
const char * | GetName () |
CascadeSharedMemZone provides an easy to use process-safe locking shared memory zone.
|
the default constructor - lightweight This default constructor is lightweight. |
|
destructor This destructor will unlock and close the SharedMemZone if necessary. |
|
closes the SharedMemZone Call Close() to close a previously opened shared memory zone. When the last handle to a shared memory zone is closed, the operating system shared memory object is destroyed. This function is provided for convenience - the destructor ~CascadeSharedMemZone() will automatically Close() the shared memory zone if it is still open when the destructor is called. Close() will automatically unlock the shared memory zone if it is map-locked, but good programming practice dictates that you should unlock the shared memory zone yourself.
|
|
gets the name of the SharedMemZone Gets the name of an open zone or NULL if zone is not open.
|
|
gets the size of the SharedMemZone Gets the size of an open zone or 0 if zone is not open.
|
|
locks and maps the SharedMemZone into your process' address space Call MapLock() to lock the shared memory zone and map it into the client process' address space. MapLock() returns the address of the mapped shared memory on success and NULL on failure. The shared memory zone must be opened with a call to Open() before MapLock() will succeed.
|
|
opens a SharedMemzone Open() opens a handle to the shared memory zone named pName with size nNumBytes creating it if necessary and bCreateIfNecessary is true. Open() returns false on failure or if the named zone already exists in a different size. Otherwise Open() returns true. If Open() creates a new shared mem zone, the first 32 bits of the zone will be initialized to zero, allowing the client to determine (after map-locking the zone), whether or not the zone is virginal. If the client makes this determination, they should put a non-zero value into the first 32 bits of the zone (while the zone is still map-locked) to prevent subsequent clients of the zone from thinking the zone is still uninitialized.
|
|
unlocks the SharedMemZone Call Unlock() to unmap and release the shared memory zone. Calls to MapLock() may nest so be sure there is a corresponding call to Unlock() for every call to MapLock().
|