ASL
SharedMem Class Reference

Detailed Description

Provides shared memory among processes.

A SharedMemory object must be created with a name and a size. Then other processes can use the same memory by creating an object with the same name and size. The function ptr() returns a pointer to the base of the shared memory block or NULL y there was a problem creating the mapping.

SharedMem memo("mymemory", 16000);
char buffer[100]; // and fill it with data
if(memo.ptr())
memcpy( memo.ptr(), buffer, 100 );
SharedMem(const String &name, int size)
Creates a shared memory object with the given name and size in bytes.

Then another process can do:

SharedMem memo("mymemory", 16000);
char buffer[100];
if(memo.ptr())
memcpy( buffer, memo.ptr(), 100 );

To read from the memory written by the first process.

Deprecated:
This class was an experiment and might be removed sometime.

#include <SharedMem.h>

Public Member Functions

 SharedMem (const String &name, int size)
 Creates a shared memory object with the given name and size in bytes. More...
 
byteptr ()
 Returns the base address of the mapping of this block in the current process or NULL on error.
 

Constructor & Destructor Documentation

◆ SharedMem()

SharedMem ( const String name,
int  size 
)

Creates a shared memory object with the given name and size in bytes.

If a segment with that name does not exist it will be created, otherwise a reference to it will be made.


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