From: simonmar Date: Tue, 6 Feb 2001 11:42:30 +0000 (+0000) Subject: [project @ 2001-02-06 11:42:30 by simonmar] X-Git-Tag: Approximately_9120_patches~2739 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=d1430fb505037999e8961fbd7e922d0e82eca0f1;p=ghc-hetmet.git [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. --- 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))