pub struct SharedMemory {
state: Arc<RwLock<SharedMemoryState>>,
id: String,
}Expand description
A shared memory object for inter-process communication
SharedMemory provides a memory region that can be mapped into multiple processes’ address spaces, allowing efficient data sharing without copying.
Fields§
§state: Arc<RwLock<SharedMemoryState>>Shared state of the memory object
id: StringUnique identifier for debugging
Implementations§
Sourcepub unsafe fn from_paddr(paddr: usize, size: usize, permissions: usize) -> Self
pub unsafe fn from_paddr(paddr: usize, size: usize, permissions: usize) -> Self
Create a shared memory object from an existing physical address
§Arguments
paddr- Physical address of the memory regionsize- Size of the memory region in bytespermissions- Access permissions
§Returns
A new shared memory object wrapping the existing memory
§Safety
The caller must ensure that the physical address is valid and the size is correct. The physical memory must remain valid for the lifetime of this object. This object will NOT free the memory on drop - the caller is responsible for managing the memory lifetime.
Sourcepub fn invalidate(&self)
pub fn invalidate(&self)
Invalidate this shared memory object
This marks the shared memory as invalid, preventing new mappings. Existing mappings may continue to work but should be unmapped.