From d1430fb505037999e8961fbd7e922d0e82eca0f1 Mon Sep 17 00:00:00 2001 From: simonmar Date: Tue, 6 Feb 2001 11:42:30 +0000 Subject: [PATCH] [project @ 2001-02-06 11:42:30 by simonmar] urk! when showing a handle, we don't replace the MVar. For example, the following test causes a deadlock: main = do getContents catch getChar (\e -> print e >> return 'x') catch getChar (\e -> print e >> return 'x') To be merged into 4.08. --- ghc/lib/std/PrelIOBase.lhs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/ghc/lib/std/PrelIOBase.lhs b/ghc/lib/std/PrelIOBase.lhs index 02aad74..6ef3f27 100644 --- a/ghc/lib/std/PrelIOBase.lhs +++ b/ghc/lib/std/PrelIOBase.lhs @@ -1,5 +1,5 @@ % ------------------------------------------------------------------------------ -% $Id: PrelIOBase.lhs,v 1.32 2001/01/11 17:25:57 simonmar Exp $ +% $Id: PrelIOBase.lhs,v 1.33 2001/02/06 11:42:30 simonmar Exp $ % % (c) The University of Glasgow, 1994-2000 % @@ -269,9 +269,10 @@ instance Show Handle where -- (Big) SIGH: unfolded defn of takeMVar to avoid -- an (oh-so) unfortunate module loop with PrelConc. hdl_ = unsafePerformIO (IO $ \ s# -> - case h of { MVar h# -> - case takeMVar# h# s# of { (# s2# , r #) -> - (# s2#, r #) }}) + case h of { MVar h# -> + case takeMVar# h# s# of { (# s2# , r #) -> + case putMVar# h# r s2# of { s3# -> + (# s3#, r #) }}}) #endif #else hdl_ = unsafePerformIO (stToIO (readVar h)) -- 1.7.10.4