summaryrefslogtreecommitdiff
path: root/Utility
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2012-10-20 12:44:25 -0400
committerGravatar Joey Hess <joey@kitenet.net>2012-10-20 12:44:25 -0400
commit50d35a77f6ad083c6eead5439e9d0ca91ee03dc5 (patch)
tree6021c5f39d2d6fe4a1ffe80e8d0895c2281ca210 /Utility
parent6f92da2474f66c0ffa3ee741383cb12cc462b61e (diff)
parent244a312b17a8ba825507296f52ab9357220102c0 (diff)
Merge branch 'safesemaphore'
Conflicts: debian/changelog git-annex.cabal
Diffstat (limited to 'Utility')
-rw-r--r--Utility/NotificationBroadcaster.hs12
1 files changed, 6 insertions, 6 deletions
diff --git a/Utility/NotificationBroadcaster.hs b/Utility/NotificationBroadcaster.hs
index accc35fe1..4bbbc544a 100644
--- a/Utility/NotificationBroadcaster.hs
+++ b/Utility/NotificationBroadcaster.hs
@@ -26,10 +26,10 @@ module Utility.NotificationBroadcaster (
import Common
import Control.Concurrent.STM
-import Control.Concurrent.SampleVar
+import Control.Concurrent.MSampleVar
-{- One SampleVar per client. The TMVar is never empty, so never blocks. -}
-type NotificationBroadcaster = TMVar [SampleVar ()]
+{- One MSampleVar per client. The TMVar is never empty, so never blocks. -}
+type NotificationBroadcaster = TMVar [MSampleVar ()]
newtype NotificationId = NotificationId Int
deriving (Read, Show, Eq, Ord)
@@ -47,7 +47,7 @@ newNotificationHandle b = NotificationHandle
<*> addclient
where
addclient = do
- s <- newEmptySampleVar
+ s <- newEmptySV
atomically $ do
l <- takeTMVar b
putTMVar b $ l ++ [s]
@@ -67,11 +67,11 @@ sendNotification b = do
l <- atomically $ readTMVar b
mapM_ notify l
where
- notify s = writeSampleVar s ()
+ notify s = writeSV s ()
{- Used by a client to block until a new notification is available since
- the last time it tried. -}
waitNotification :: NotificationHandle -> IO ()
waitNotification (NotificationHandle b (NotificationId i)) = do
l <- atomically $ readTMVar b
- readSampleVar (l !! i)
+ readSV (l !! i)