stm-chans

Additional types of channels for STM.

http://wrengr.org

Version on this page:3.0.0.5
LTS Haskell 22.21:3.0.0.9
Stackage Nightly 2024-05-06:3.0.0.9
Latest on Hackage:3.0.0.9

See all snapshots stm-chans appears in

BSD-3-Clause licensed by wren gayle romano, Thomas DuBuisson
Maintained by [email protected]
This version can be pinned in stack with:stm-chans-3.0.0.5@sha256:fe2595d4687c89312709eddea71338c7070e09d7d4347fa1d796a8024d85f6b3,2501

stm-chans

Hackage version Build Status Dependencies

This package offers a collection of channel types, similar to Control.Concurrent.STM.{TChan,TQueue} but with additional features. In particular we offer the following data 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.
  • Control.Concurrent.STM.TMQueue: Closeable FIFO queues. 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.
  • Control.Concurrent.STM.TBMQueue: Bounded Closeable FIFO queues. Combines the capabilities of TBChan and TMChan.

Install

In general, this is a simple package and should be easy to install. It does require GHC however, because it relies on the Control.Concurrent.STM.TChan type which (for some unknown reason) is GHC-only. With the cabal-install program you can just do:

$> cabal install stm-chans

Or if you don’t have cabal-install, then you can use the Cabal library:

$> runhaskell Setup.hs configure
$> runhaskell Setup.hs build
$> runhaskell Setup.hs test
$> runhaskell Setup.hs haddock --hyperlink-source
$> runhaskell Setup.hs copy
$> runhaskell Setup.hs register

The test step is optional and currently does nothing. The Haddock step is also optional.

Links