#include <GSharedMemory.h>
Public Member Functions | |
GSharedMemory (const char *Name, int Size) | |
Construt the shared memory. | |
virtual | ~GSharedMemory () |
void * | GetPtr () |
Returns the start of the block. | |
int | GetSize () |
Returns the number of bytes addressable. | |
void | Destroy () |
Disconnects from the shared memory resource. |
This class enables separate processes to access the same peice of memory. A full discussion of the problems of pre-emptively multi-tasked processes accessing the same memory is beyond the scope of this document but suffice to say you need to know what your doing.
Initially all the bytes of the memory block are initialized to 0.
GSharedMemory::GSharedMemory | ( | const char * | Name, | |
int | Size | |||
) |
Construt the shared memory.
Name | The unique name of the memory block. Should be the same string used by all processes wishing to access the same memory. |
Size | The number of bytes to allocate, should also be the same in all processes connecting to the shared memory. |
GSharedMemory::~GSharedMemory | ( | ) | [virtual] |
Disconnect from the shared memory and free resources. This doesn't delete the shared memory block on Linux.