ivar-simple-0.3: Write once concurrency primitives.

MaintainerBertram Felgenhauer <int-e@gmx.de>
Safe HaskellSafe-Infered



An MIChan is a multicast channel built on top of an IChan.

Like IChan, this channel supports multiple readers. It is comparable to a Control.Concurrent.Chan.Chan for the writing end: Each write will append an element to the channel. No writes will fail.



Comparison to Control.Concurrent.Chan:

 Control.Concurrent.Chan.Chan => Data.MIChan
 newChan                      => new
 writeChan                    => write
 getChanContents              => read
 writeList2Chan               => writeList

These can't be implemented:

 readChan     (can't steal items from other readers)
 unGetChan    (there is no separate reading end)
 isEmptyChan  (needs an IO interface for reading)
 dupChan      (not needed)

data MIChan a Source

A multicast channel.

new :: IO (MIChan a)Source

Create a new multicast channel.

read :: MIChan a -> IO [a]Source

Return the list of values that the channel represents.

write :: MIChan a -> a -> IO ()Source

Send a value across the channel.

writeList :: MIChan a -> [a] -> IO ()Source

Send several values across the channel, atomically.