ASL
Loading...
Searching...
No Matches
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 );
An Array is a contiguous and resizable array of any type of elements.
Definition Array.h:77
const T * ptr() const
Returns a pointer to the first element.
Definition Array.h:230
Provides shared memory among processes.
Definition SharedMem.h:45

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 <asl/SharedMem.h>

Public Member Functions

 SharedMem (const String &name, int size)
 Creates a shared memory object with the given name and size in bytes.
 
byte * ptr ()
 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: