[commit: base] data-proxy,master: Fix #7787 (fd39d59)

Richard Eisenberg eir at ghc.haskell.org
Tue Jul 23 16:04:14 CEST 2013


Repository : http://darcs.haskell.org/ghc.git/

On branches: data-proxy,master

http://hackage.haskell.org/trac/ghc/changeset/fd39d598e570145ac144b9cb6512c7faa3092ae1

>---------------------------------------------------------------

commit fd39d598e570145ac144b9cb6512c7faa3092ae1
Author: Simon Marlow <marlowsd at gmail.com>
Date:   Fri Jul 19 09:09:39 2013 +0100

    Fix #7787
    
    Now the pair is evaluated strictly inside the exception handler.  I
    figured this would be less likely to introduce space leaky bugs than
    using an irrefutable pattern match.

>---------------------------------------------------------------

 Control/Concurrent/MVar.hs |    4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/Control/Concurrent/MVar.hs b/Control/Concurrent/MVar.hs
index bfe72a8..63c3837 100644
--- a/Control/Concurrent/MVar.hs
+++ b/Control/Concurrent/MVar.hs
@@ -225,7 +225,7 @@ modifyMVar :: MVar a -> (a -> IO (a,b)) -> IO b
 modifyMVar m io =
   mask $ \restore -> do
     a      <- takeMVar m
-    (a',b) <- restore (io a) `onException` putMVar m a
+    (a',b) <- restore (io a >>= evaluate) `onException` putMVar m a
     putMVar m a'
     return b
 
@@ -250,7 +250,7 @@ modifyMVarMasked :: MVar a -> (a -> IO (a,b)) -> IO b
 modifyMVarMasked m io =
   mask_ $ do
     a      <- takeMVar m
-    (a',b) <- io a `onException` putMVar m a
+    (a',b) <- (io a >>= evaluate) `onException` putMVar m a
     putMVar m a'
     return b
 






More information about the ghc-commits mailing list