Skip to content

Commit 2914d31

Browse files
authored
Refactor shared memory host mappings (#1485)
* Refactor host mapping to use RAII guards Wrap host-mapping lifetime management in dedicated RAII guards. On Linux `Mmap` owns the `mmap` reservation and calls `munmap` on drop. On Windows `MappedView` owns the mapped view and calls `UnmapViewOfFile`, and `FileMapping` owns the file-mapping HANDLE and calls `CloseHandle`. `HostMapping` becomes a thin aggregate of these guards instead of carrying raw `(ptr, size, handle)` fields with a manual `Drop` impl, and exposes `ptr()`, `size()`, and `file_mapping_handle()` accessors that the `SharedMemory` trait defaults use. Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> * Move stuff around Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com> --------- Signed-off-by: Ludvig Liljenberg <4257730+ludfjig@users.noreply.github.com>
1 parent 6487a00 commit 2914d31

1 file changed

Lines changed: 634 additions & 542 deletions

File tree

0 commit comments

Comments
 (0)