| miniplex-0.2.1: simple 1-to-N interprocess communication | Contents | Index |
|
|
|
|
|
Description |
Asynchronous message broadcasting.
|
|
Synopsis |
|
|
|
|
Caveat
|
|
This module performs writes on sockets that may be closed at any time,
triggering SIGPIPE signals. It is therefore recommended that you call
installHandler openEndedPipe
Ignore Nothing at the beginning of your
program.
|
|
data Sink |
Instances | |
|
|
create :: String -> IO Sink |
create tag creates a message sink. tag is used to uniquely
identify this sink. The set of allowed characters for tag includes
letters, digits, _, - and +.
(Implementation detail: This function actually creates a named socket
in your ~/.miniplex/.)
|
|
write :: Sink -> String -> IO () |
write si msg asynchronously writes msg to si, where it will be
received by all currently connected readers.
|
|
destroy :: Sink -> IO () |
Deallocates a sink. The destroyed sink must not be used again.
(Implementation detail: This function closes and removes the socket from
the file system. If you forget to call it, you'll leave a stale entry in
~/.miniplex/, which will cause calls to create with the same tag to
fail.)
|
|
withSink :: String -> (Sink -> IO a) -> IO a |
Helper function to simplify resource handling. withSink tag body
creates a sink, calls body, then destroys the sink, even if body
throws an exception.
|
|
Produced by Haddock version 0.8 |