Copyright | (c) The University of Glasgow 2002 |
---|---|
License | BSD-style (see the file libraries/base/LICENSE) |
Maintainer | William N. Halchin (vigalchin@gmail.com) |
Stability | provisional |
Portability | non-portable (requires POSIX) |
Safe Haskell | None |
Language | Haskell98 |
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 Source | |
Storable MQAttributes Source | 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!
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 MQAttributes Source
Get the attributes for an existing POSIX message queue designated by | "mqd"
mqSetAttributes :: Fd -> MQAttributes -> IO MQAttributes Source
Set the attributes for an existing POSIX mqueue designated by "mqd" and | retrieve old attributes