Control.Concurrent.STM.BTChan
- data BTChan a
- newBTChan :: Int -> STM (BTChan a)
- newBTChanIO :: Int -> IO (BTChan a)
- writeBTChan :: BTChan a -> a -> STM ()
- readBTChan :: BTChan a -> STM a
- isEmptyBTChan :: BTChan a -> STM Bool
- sizeOfBTChan :: BTChan a -> STM Int
- setMaxOfBTChan :: BTChan a -> Int -> BTChan a
- maxOfBTChan :: BTChan a -> Int
Documentation
newBTChanIO :: Int -> IO (BTChan a)Source
An IO version of newBTChanIO. This should be useful with unsafePerformIO
in the same manner as newTVarIO and newTChanIO are used.
writeBTChan :: BTChan a -> a -> STM ()Source
Writes the value to the BTChan or blocks if the channel is full.
readBTChan :: BTChan a -> STM aSource
Reads the next value from the BTChan
setMaxOfBTChan :: BTChan a -> Int -> BTChan aSource
c2 = setMaxOfBTChan c1 mx Using the same underlying TChan,
set a new maximum number of messages, mx. If the current size
is greater than mx then no messages are dropped, but writes
will block till the size goes lower than mx. Using c2 and
c1 concurrently is possible, but c2 writes will block at the new
maximum while writes to c1 will block at the new, making it biased
against whichever writer has the channel with the smaller bound.
maxOfBTChan :: BTChan a -> IntSource
Get the bound of the BTChan.