# Home    # nevrax.com   
Nevrax
Nevrax.org
#News
#Mailing-list
#Documentation
#CVS
#Bugs
#License
Docs
 
Documentation  
Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members   Related Pages   Search  

NLMISC::CSharedMemory Class Reference

Encapsulation of shared memory APIs. More...

#include <shared_memory.h>

List of all members.

Static Public Methods

void * createSharedMemory (TSharedMemId sharedMemId, uint32 size)
 Create a shared memory segment and get access to it. More...

void * accessSharedMemory (TSharedMemId sharedMemId)
 Get access to an existing shared memory segment. More...

bool closeSharedMemory (void *accessAddress)
 Close a shared memory segment, given the address returned by createSharedMemory() or accessSharedMemory(). More...

void destroySharedMemory (TSharedMemId sharedMemId, bool force=false)
 Destroy a shared memory segment (must be call by the process that created the segment, not by the accessors). More...


Detailed Description

Encapsulation of shared memory APIs.

Using file mapping under Windows, System V shared memory (shm) under Linux.

Note: under Linux, an option could be added to prevent a segment to be swapped out.

Author:
Olivier Cado , Nevrax France
Date:
2002

Definition at line 68 of file shared_memory.h.


Member Function Documentation

void * NLMISC::CSharedMemory::accessSharedMemory TSharedMemId    sharedMemId [static]
 

Get access to an existing shared memory segment.

The id must be used.

Returns:
Access address of the segment. Its size was determined at the creation.

Definition at line 90 of file shared_memory.cpp.

References NLMISC::TSharedMemId.

bool NLMISC::CSharedMemory::closeSharedMemory void *    accessAddress [static]
 

Close a shared memory segment, given the address returned by createSharedMemory() or accessSharedMemory().

Must be called by each process that called createSharedMemory() or accessSharedMemory().

Definition at line 125 of file shared_memory.cpp.

void * NLMISC::CSharedMemory::createSharedMemory TSharedMemId    sharedMemId,
uint32    size
[static]
 

Create a shared memory segment and get access to it.

The id must not be used. The id 0x3a732235 is used by the NeL memory manager.

Returns:
Access address of the segment of the choosen size

Definition at line 55 of file shared_memory.cpp.

References NLMISC::SharedMemIdsToShmids, and NLMISC::TSharedMemId.

void NLMISC::CSharedMemory::destroySharedMemory TSharedMemId    sharedMemId,
bool    force = false
[static]
 

Destroy a shared memory segment (must be call by the process that created the segment, not by the accessors).

"Rescue feature": set "force" to true if a segment was created and left out of control (meaning a new createSharedMemory() with the same sharedMemId fails), but before, make sure the segment really belongs to you!

Note: this method does nothing under Windows, destroying is automatic.

Definition at line 159 of file shared_memory.cpp.

References NLMISC::SharedMemIdsToShmids, and NLMISC::TSharedMemId.


The documentation for this class was generated from the following files: