Portability | non-portable (requires POSIX) |
---|---|
Stability | provisional |
Maintainer | William N. Halchin (vigalchin@gmail.com) |
Safe Haskell | None |
POSIX 1003.1b message queue support.
- data MQAttributes = MQAttributes {
- flags :: Int
- maxMsgNum :: Int
- maxMsgSize :: Int
- curNumMsgs :: Int
- mqOpen :: Name -> OpenMode -> Maybe FileMode -> Maybe MQAttributes -> IO Fd
- mqClose :: Fd -> IO ()
- mqUnlink :: String -> IO ()
- mqSend :: Fd -> String -> ByteCount -> Int -> IO ()
- mqReceive :: Fd -> ByteCount -> Maybe Int -> IO (String, Int)
- mqGetAttributes :: Fd -> IO MQAttributes
- mqSetAttributes :: Fd -> MQAttributes -> IO MQAttributes
- mqNotify :: Fd -> Maybe Sigevent -> IO ()
Message queue attributes data type
data MQAttributes Source
MQAttributes | |
|
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 ...
Sending/receiving data
Programmers using the mqSend
and mqReceive
API should be aware that
EAGAIN exceptions may occur for non-blocking IO!
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