diff options
author | Joey Hess <joey@kitenet.net> | 2013-04-24 17:16:04 -0400 |
---|---|---|
committer | Joey Hess <joey@kitenet.net> | 2013-04-24 17:16:04 -0400 |
commit | d265917659b09e30d7ad0db345621b9b06288274 (patch) | |
tree | fae1418bcb47c0b1a9897b1c25935e4db6ce9a26 /Utility | |
parent | 9467d2bb7289c0769c1837c92595789c88301a84 (diff) |
remove last use of TSet
Diffstat (limited to 'Utility')
-rw-r--r-- | Utility/TSet.hs | 41 |
1 files changed, 0 insertions, 41 deletions
diff --git a/Utility/TSet.hs b/Utility/TSet.hs deleted file mode 100644 index c5ee22c89..000000000 --- a/Utility/TSet.hs +++ /dev/null @@ -1,41 +0,0 @@ -{- Transactional sets - - - - Copyright 2012, 2013 Joey Hess <joey@kitenet.net> - -} - -module Utility.TSet where - -import Common - -import Control.Concurrent.STM - -type TSet = TChan - -newTSet :: STM (TSet a) -newTSet = newTChan - -{- Gets the contents of the TSet. Blocks until at least one item is - - present. -} -getTSet :: TSet a -> STM [a] -getTSet tset = do - c <- readTChan tset - l <- readTSet tset - return $ c:l - -{- Gets anything currently in the TSet, without blocking. -} -readTSet :: TSet a -> STM [a] -readTSet tset = go [] - where - go l = do - v <- tryReadTChan tset - case v of - Nothing -> return l - Just c -> go (c:l) - -{- Puts items into a TSet. -} -putTSet :: TSet a -> [a] -> STM () -putTSet tset vs = mapM_ (writeTChan tset) vs - -{- Put a single item into a TSet. -} -putTSet1 :: TSet a -> a -> STM () -putTSet1 tset v = void $ writeTChan tset v |