|
VLink 2.0.0
A high-performance communication middleware
|
Named cross-process shared memory region. 更多...
类 | |
| class | vlink::SysSharemem |
| Named cross-process shared memory backed by the OS IPC layer. 更多... | |
命名空间 | |
| namespace | vlink |
Named cross-process shared memory region.
SysSharemem wraps the POSIX shared-memory API (shm_open + mmap) on Linux/macOS and the Win32 CreateFileMapping / MapViewOfFile API on Windows to provide a named shared memory region that multiple processes can map into their address space simultaneously.
Lifecycle:
SysSharemem object.create(name, size) to allocate and map the region.attach(name) to map the existing region.data().detach(force) to unmap. If force is true, POSIX backends also unlink the backing object from the OS namespace.detach() automatically with force == false.Access modes:
| Mode | Description |
|---|---|
| kReadOnly | Maps with PROT_READ (no write access) |
| kReadWrite | Maps with PROT_READ | PROT_WRITE (default) |
"/vlink_cam0"). On Windows any non-empty name is valid.create(). The caller must initialise the region before use.SysSemaphore or a mutex in the shared region itself).size() returns 0 when not attached.