posix-realtime- POSIX Realtime functionality

Portabilitynon-portable (requires POSIX)
MaintainerWilliam N. Halchin (vigalchin@gmail.com)
Safe HaskellNone




POSIX 1003.1b message queue support.


Message queue attributes data type

data MQAttributes Source




flags :: Int
maxMsgNum :: Int
maxMsgSize :: Int
curNumMsgs :: Int


Show MQAttributes 
Storable MQAttributes

MQAttributes Storable used to marshall and unmarshall to ANSI C

Opening/closing/unlinking mqueues



:: Name 
-> OpenMode 
-> Maybe FileMode

Just x => creates the file with the given modes, Nothing => the file must exist.

-> Maybe MQAttributes 
-> IO Fd 

Open and optionally create this message queue. See Files | for information on how to use the FileMode type. | Note: After referring to several mqueue implementations, it seems that the | POSIX standard doesn't tightly constrain Name's syntax. E.g. one Linux | implementation expects that Name starts with a /. This is a warning | to the user. The author wasted a fair amount of time on this issue and | and doesn't wish this on others ...

mqClose :: Fd -> IO ()Source

Close a POSIX mqueue designated by mqd

mqUnlink :: String -> IO ()Source

Unlink (destroy) an existing POSIX mqueue designated by name

Sending/receiving data

Programmers using the mqSend and mqReceive API should be aware that EAGAIN exceptions may occur for non-blocking IO!

mqSend :: Fd -> String -> ByteCount -> Int -> IO ()Source

Send a message on mqueue designated by mqd

mqReceive :: Fd -> ByteCount -> Maybe Int -> IO (String, Int)Source

Retrieve a message from mqueue designated by mqd

Getting/Setting mqueue attributes

mqGetAttributes :: Fd -> IO MQAttributesSource

Get the attributes for an existing POSIX message queue designated by | mqd

mqSetAttributes :: Fd -> MQAttributes -> IO MQAttributesSource

Set the attributes for an existing POSIX mqueue designated by mqd and | retrieve old attributes

Notify receipt of message

mqNotify :: Fd -> Maybe Sigevent -> IO ()Source

Notify a registered process of the new-message-in-empty-queue event!