PriorityChansConverger-0.1: Read single output from an array of inputs - channels with priorities





data TChanB a Source



elasticWriteTChanB :: PermitToBlock -> TChanB a -> a -> STM WriteSucceededSource

The "elastic-" prefix stands for the opportunity to regulate with option PermitToBlock

writeTChanB :: TChanB a -> a -> STM ()Source

Wrapper around elasticWriteTChanB: writeTChanB tchb a = return () << elasticWriteTChanB True tchb a

tryWriteTChanB :: TChanB a -> a -> STM BoolSource

Wrapper around elasticWriteTChanB: tryWriteTChanB = elasticWriteTChanB False

getTChanBContents :: TChanB a -> STM [a]Source

Take everything from channel, and leave it empty.

elacticWriteList2TChanB :: PermitToBlock -> TChanB a -> [a] -> STM [a]Source

This procedure is highly uneffective and is dangerous, when PermitToBlock is on. Since it won't complete unless there is enough free space in the channnel. Even the part of input that fits won't commit to get into the channel. If capacity isn't enough, it won't ever commit, unless the capacity is made bigger.

filterOutTChanBElements :: (a -> TakeElementOutShouldWe) -> TChanB a -> STM [a]Source

Just filter out elements. Is abstracted over implementation, so doesn't suffer from possible inconsistency between capacity and load (when capacity < load).