[Haskell-cafe] ANN: stm-chans 1.3.1
wren ng thornton
wren at freegeek.org
Thu Mar 1 04:45:19 CET 2012
--------------------------------------------
-- stm-chans 1.3.1
--------------------------------------------
The stm-chans package offers a collection of channel types, similar to
Control.Concurrent.STM.TChan but with additional features.
--------------------------------------------
-- Changes (since 1.2.0)
--------------------------------------------
* (Version 1.3.1) The new stm-2.3 has finally been released with all the
new optimized operations on TVars, TMVars, and TChans. I've updated the
CPP macros in the Compat modules so that now they will actually switch
over to the optimized implementations (instead of waiting for stm-9.0 :)
It's highly recommended that all users bump their minimum stm-chans
requirement to version 1.3.1.
* (Version 1.3.0) Added Control.Concurrent.STM.TMVar.Compat for the
stm-2.3 function tryReadTMVar.
--------------------------------------------
-- Long description
--------------------------------------------
In particular stm-chans offers these types:
* Control.Concurrent.STM.TBChan: Bounded FIFO channels.
When the channel is full, writers will block/retry. This ensures
that the writers do not get too far ahead of the readers, which helps to
make sure that memory and cpu resources are used responsibly.
* Control.Concurrent.STM.TMChan: Closeable FIFO channels.
This is like TChan (Maybe a) but with a monotonicity guarantee that
once Nothing is returned all future reads will be Nothing as well.
* Control.Concurrent.STM.TBMChan: Bounded Closeable FIFO channels.
This combines the capabilities of TBChan and TMChan.
In addition, the stm-chans package offers a (partial) compatibility
layer for the recent API improvements to the stm package (see ticket
#5104 [1]). Among others, these new functions include:
* tryReadTChan :: TChan a -> STM (Maybe a)
A version of readTChan which does not retry. Instead it returns
Nothing if no value is available.
* peekTChan :: TChan a -> STM a
Get the next value from the TChan without removing it, retrying if
the channel is empty.
* tryPeekTChan :: TChan a -> STM (Maybe a)
A version of peekTChan which does not retry. Instead it returns
Nothing if no value is available.
[1] http://hackage.haskell.org/trac/ghc/ticket/5104
--------------------------------------------
-- Links
--------------------------------------------
Homepage:
http://code.haskell.org/~wren/
Hackage:
http://hackage.haskell.org/package/stm-chans
Darcs:
http://community.haskell.org/~wren/stm-chans
Haddock (Darcs version):
http://community.haskell.org/~wren/stm-chans/dist/doc/html/stm-chans
--
Live well,
~wren
More information about the Haskell-Cafe
mailing list