-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Implementation of bounded Chans. -- -- This library introduces BoundedChan. BoundedChan works exactly like -- Chan -- and, indeed, has the exact same interface -- but is guaranteed -- to operate in a bounded amount of space. @package BoundedChan @version 1.0.0.0 -- | Implements bounded channels. In these channels, you can give a rough -- maximum number of elements, and you will be guaranteed that no more -- than that number of elements will be pending within the channel. -- -- This boundedness is ideal when you will be (or may be) writing to a -- channel faster than you are able to read from it. -- -- This module supports all the functions of Control.Concurrent.Chan -- except unGetChan and dupChan, which are not supported for bounded -- channels. module Control.Concurrent.BoundedChan -- | BoundedChan is an abstract data type representing an unbounded -- channel. data BoundedChan a -- | Create a new bounded chan with size n. newBoundedChan :: Int -> IO (BoundedChan a) -- | Write an element to the channel. If the channel is full, this routine -- will block until it is able to write. If you have multiple writers, be -- careful here, because the unlocking is not guaranteed to avoid -- starvation. writeChan :: BoundedChan a -> a -> IO () -- | Read an element from the channel. If the channel is empty, this -- routine will block until it is able to read. readChan :: BoundedChan a -> IO a isEmptyChan :: BoundedChan a -> IO Bool getChanContents :: BoundedChan a -> IO [a] -- | Write a list of elements to the channel. Note that this may block as -- it writes the list into the channel. writeList2Chan :: BoundedChan a -> [a] -> IO ()