shared-buffer-0.1.0.6: A circular buffer built on shared memory

Safe HaskellSafe-Inferred
LanguageHaskell98

System.Posix.SharedBuffer

Contents

Synopsis

Main shared memory interface

openSBuffer :: String -> CInt -> ShmOpenFlags -> [Protection] -> FileMode -> IO SharedBuffer Source

Open a shared memory object, then mmap it, with the specified flags.

closeSharedBuffer :: SharedBuffer -> IO () Source

Close a reference to a shared memory object. Just calls munmap.

removeSharedBuffer :: SharedBuffer -> IO () Source

Close a reference to a shared memory object and removes it. Calls munmap followed by shm_unlink

unlinkSharedBuffer :: SharedBuffer -> IO () Source

Unlink a shared buffer (shm_unlink) without closing the reference to it. Any processes that have already opened the buffer (including this one) should be able to continue accessing it.

After unlinkSharedBuffer, references should be closed with closeSharedBuffer.

private stuff (exported for wizards)

data SharedBuffer Source

A shared memory object

Constructors

SharedBuffer 

Fields

sbPtr :: !(Ptr ())
 
sbLen :: !CInt
 
sbName :: String
 

Instances

generalized buffer access

data Flags Source

Constructors

MapShared 
MapPrivate 

re-exports

data ShmOpenFlags :: *

Constructors

ShmOpenFlags 

Fields

shmReadWrite :: Bool

If true, open the shm object read-write rather than read-only.

shmCreate :: Bool

If true, create the shm object if it does not exist.

shmExclusive :: Bool

If true, throw an exception if the shm object already exists.

shmTrunc :: Bool

If true, wipe the contents of the shm object after opening it.