#include <SYS_SharedMemory.h>
Creates a read-only shared memory object, that accesses an existing shared memory buffer, using a unique identifier.
Definition at line 26 of file SYS_SharedMemory.h.
SYS_SharedMemory::SYS_SharedMemory |
( |
exint |
size = 0 | ) |
|
Create a new shared memory block of a given size. This constructor can fail, so you must use isValid to check for validity.
SYS_SharedMemory::SYS_SharedMemory |
( |
exint |
size, |
|
|
const char * |
id |
|
) |
| |
Create a new shared memory block with the given name and size. This constructor can fail, so you must use isValid to check for validity.
SYS_SharedMemory::SYS_SharedMemory |
( |
const char * |
id, |
|
|
bool |
read_only = true |
|
) |
| |
Open an existing shared memory block through the given identifier. This constructor can fail, so you must use isValid to check for validity.
SYS_SharedMemory::~SYS_SharedMemory |
( |
| ) |
|
int64 SYS_SharedMemory::getMemoryUsage |
( |
bool |
inclusive | ) |
const |
Returns an approximation of the memory used by these structures, NOT the shared memory itself.
const char* SYS_SharedMemory::id |
( |
| ) |
const |
Returns the identifier of the shared memory segment, such that it can be opened from another process. The pointer is valid as long as this object is.
bool SYS_SharedMemory::isValid |
( |
| ) |
const |
Returns whether the shared memory is in a valid state for reading/writing. If the constructor failed to initialize the shared memory, an invalid shared memory size was supplied (such as 0), or the shared memory was closed, then this method will return false.
bool SYS_SharedMemory::readOnly |
( |
| ) |
const |
Returns true if this shared memory is read-only.
bool SYS_SharedMemory::reset |
( |
exint |
size, |
|
|
const char * |
id = nullptr |
|
) |
| |
Resets the shared memory to the given size and name, if specified. This has the effect of removing the previous shared memory segment (unless it's already open by someone else, in which case it gets deleted when that user closes it). If an id is not specified in the arguments, a new id() will be generated in order to avoid a potential conflict with potentially still opened previous shared memory section.
The shared memory cannot be reset if it was opened from an existing identifier.
static void SYS_SharedMemory::setTempDir |
( |
const char * |
path | ) |
|
|
static |
On some operating systems, shared memory is handled using a file system interface. On these systems, we need to know where the temporary files should be installed. This is typically in HOUDINI_TEMP_DIR.
Note: This is not thread safe, and should only be done once
exint SYS_SharedMemory::size |
( |
| ) |
const |
Returns the size of the shared memory, in bytes.
The documentation for this class was generated from the following file: