shared-memory-0.2.0.0: POSIX shared memory

Safe HaskellSafe
LanguageHaskell98

SharedMemory

Description

Provides shared memory for IPC (Inter Process Communication).

Synopsis

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.

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.