| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Control.Concurrent.PostMessAge
Description
- data Passer a
- createPasser :: Handle -> (Handle -> a -> IO ()) -> IO (Passer a)
- closePasser :: Passer a -> IO ()
- postMessage :: Passer a -> a -> IO Bool
- isPasserClosed :: Passer a -> IO Bool
- isPasserOpen :: Passer a -> IO Bool
Passer type
The Passer is the object that you send the messages to.
It will redirect this message to its attached Handle,
making sure the messages are not intercalated.
Use postMessage to send message to a passer object.
Open/Close a passer
Create a passer object from a Handle and a function to send
values to that handle.
closePasser :: Passer a -> IO () Source
Close a passer object, so it won't receive any more messages
in the future. Once a passer object is closed, it can't be
opened again. If you want to reuse a handle, create another
passer object with createPasser.
Send messages to the passer
postMessage :: Passer a -> a -> IO Bool Source
Send a message to a passer object. It returns a value indicating if the message reached the passer object.
Check passer status
isPasserClosed :: Passer a -> IO Bool Source
Check if a passer object is closed. When a passer object is closed, it won't send any more messages to its attached handle. This does not mean the handle itself is closed.
isPasserOpen :: Passer a -> IO Bool Source
Check if a passer object is open. While a passer object is open, all the messages received by the passer are sent to its attached handle.