Repository : ssh://darcs.haskell.org//srv/darcs/ghc

On branch  : master

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

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

commit e8dbeed6f95f94ed7b6694a268e5227049546fed
Author: Paolo Capriotti <[email protected]>
Date:   Thu Mar 29 23:19:04 2012 +0100

    Fix a race condition in the GHCi debugger exposed by testcase break011.

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

 compiler/main/InteractiveEval.hs |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/compiler/main/InteractiveEval.hs b/compiler/main/InteractiveEval.hs
index 8cc94a3..c87c62b 100644
--- a/compiler/main/InteractiveEval.hs
+++ b/compiler/main/InteractiveEval.hs
@@ -758,11 +758,16 @@ abandonAll = do
 --          with the partial computation, which still ends in takeMVar,
 --          so any attempt to evaluate one of these thunks will block
 --          unless we fill in the MVar.
+--      (c) wait for the thread to terminate by taking its status MVar.  This
+--          step is necessary to prevent race conditions with
+--          -fbreak-on-exception (see #5975).
 --  See test break010.
 abandon_ :: Resume -> IO ()
 abandon_ r = do
   killThread (resumeThreadId r)
   putMVar (resumeBreakMVar r) ()
+  _ <- takeMVar (resumeStatMVar r)
+  return ()
 
 -- 
-----------------------------------------------------------------------------
 -- Bounded list, optimised for repeated cons



_______________________________________________
Cvs-ghc mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/cvs-ghc

Reply via email to