| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
SharedMemory
Description
Provides shared memory for IPC (Inter Process Communication).
Synopsis
- openSharedMemory :: String -> CSize -> ShmOpenFlags -> FileMode -> IO (ForeignPtr (), Fd)
Documentation
openSharedMemory :: String -> CSize -> ShmOpenFlags -> FileMode -> IO (ForeignPtr (), Fd) Source #
openSharedMemory shmemPath size openFlags openFileMode:
Creates a shared memory file using shm_open at shmemPath of size bytes,
returning the created Fd and ForeignPtr pointing to the mmap'ed memory.
Note that there are portability considerations, that put constraints on what
you can pass to this function. For example, shmemPath is recommended to
start with /, and BSD as of writing requires that. Consult man shm_open.
The Fd can be used to resize the shared memory region.
When the returned ForeignPtr is garbage collected, the memory is munmap'ed,
but the Fd remains open until it is closed or garbage collected.
Closing the Fd will not invalidate the returned ForeignPtr.