[commit: packages/stm] master: Another rework of Weak interface (f7db2c3)
git at git.haskell.org
git at git.haskell.org
Fri Sep 25 10:38:51 UTC 2015
Repository : ssh://git@git.haskell.org/stm
On branch : master
Link : http://git.haskell.org/packages/stm.git/commitdiff/f7db2c3df86ec644e5e06baa8090a1cb525754e2
>---------------------------------------------------------------
commit f7db2c3df86ec644e5e06baa8090a1cb525754e2
Author: Ben Gamari <ben at smart-cactus.org>
Date: Thu Sep 24 17:40:15 2015 +0200
Another rework of Weak interface
>---------------------------------------------------------------
f7db2c3df86ec644e5e06baa8090a1cb525754e2
Control/Concurrent/STM/TMVar.hs | 5 +----
Control/Concurrent/STM/TVar.hs | 5 +----
2 files changed, 2 insertions(+), 8 deletions(-)
diff --git a/Control/Concurrent/STM/TMVar.hs b/Control/Concurrent/STM/TMVar.hs
index eed4a9b..f3ac30a 100644
--- a/Control/Concurrent/STM/TMVar.hs
+++ b/Control/Concurrent/STM/TMVar.hs
@@ -159,9 +159,6 @@ isEmptyTMVar (TMVar t) = do
--
-- @since 2.4.4
mkWeakTMVar :: TMVar a -> IO () -> IO (Weak (TMVar a))
-mkWeakTMVar tmv@(TMVar (TVar t#)) f = IO $ \s ->
+mkWeakTMVar tmv@(TMVar (TVar t#)) (IO finalizer) = IO $ \s ->
case mkWeak# t# tmv finalizer s of (# s1, w #) -> (# s1, Weak w #)
- where
- finalizer :: State# RealWorld -> State# RealWorld
- finalizer s' = case unIO f s' of (# s'', () #) -> s''
#endif
diff --git a/Control/Concurrent/STM/TVar.hs b/Control/Concurrent/STM/TVar.hs
index dbf5321..88a6dfb 100644
--- a/Control/Concurrent/STM/TVar.hs
+++ b/Control/Concurrent/STM/TVar.hs
@@ -76,8 +76,5 @@ swapTVar var new = do
--
-- @since 2.4.3
mkWeakTVar :: TVar a -> IO () -> IO (Weak (TVar a))
-mkWeakTVar t@(TVar t#) f = IO $ \s ->
+mkWeakTVar t@(TVar t#) (IO finalizer) = IO $ \s ->
case mkWeak# t# t finalizer s of (# s1, w #) -> (# s1, Weak w #)
- where
- finalizer :: State# RealWorld -> State# RealWorld
- finalizer s' = case unIO f s' of (# s'', () #) -> s''
More information about the ghc-commits
mailing list