Minor bugfixes for concurrency support in Hugs.
Evaluator.c: correctly handle case of entering a black hole.
Prelude.hs: better exception catching in forkIO and primRunIO
GC.c: (revert_dead_CAFs): don't ASSERT(0) on a dead CAF
(I don't know why this assert was there)
-- used when Hugs invokes top level function
primRunIO :: IO () -> ()
primRunIO m
- = protect (fst (unST m realWorld))
+ = protect 5 (fst (unST m realWorld))
where
realWorld = error "primRunIO: entered the RealWorld"
- protect :: () -> ()
- protect comp
- = primCatch comp (\e -> fst (unST (putStr (show e ++ "\n")) realWorld))
+ protect :: Int -> () -> ()
+ protect 0 comp
+ = comp
+ protect n comp
+ = primCatch (protect (n-1) comp)
+ (\e -> fst (unST (putStr (show e ++ "\n")) realWorld))
trace, trace_quiet :: String -> a -> a
trace s x
-- used when Hugs invokes top level function
primRunIO :: IO () -> ()
primRunIO m
- = protect (fst (unST m realWorld))
+ = protect 5 (fst (unST m realWorld))
where
realWorld = error "primRunIO: entered the RealWorld"
- protect :: () -> ()
- protect comp
- = primCatch comp (\e -> fst (unST (putStr (show e ++ "\n")) realWorld))
+ protect :: Int -> () -> ()
+ protect 0 comp
+ = comp
+ protect n comp
+ = primCatch (protect (n-1) comp)
+ (\e -> fst (unST (putStr (show e ++ "\n")) realWorld))
trace, trace_quiet :: String -> a -> a
trace s x
* Copyright (c) 1994-1998.
*
* $RCSfile: Evaluator.c,v $
- * $Revision: 1.28 $
- * $Date: 1999/11/18 12:10:26 $
+ * $Revision: 1.29 $
+ * $Date: 1999/11/18 16:02:18 $
* ---------------------------------------------------------------------------*/
#include "Rts.h"
case CAF_BLACKHOLE:
case SE_CAF_BLACKHOLE:
{
- /*was StgBlackHole* */
- StgBlockingQueue* bh = (StgBlockingQueue*)obj;
- /* Put ourselves on the blocking queue for this black hole and block */
- cap->rCurrentTSO->link = bh->blocking_queue;
- bh->blocking_queue = cap->rCurrentTSO;
- xPushCPtr(obj); /* code to restart with */
- barf("enter: CAF_BLACKHOLE unexpected!");
- RETURN(ThreadBlocked);
+ /* Let the scheduler figure out what to do :-) */
+ cap->rCurrentTSO->whatNext = ThreadEnterGHC;
+ xPushCPtr(obj);
+ RETURN(ThreadYielding);
}
case AP_UPD:
{
/* -----------------------------------------------------------------------------
- * $Id: GC.c,v 1.66 1999/11/09 15:46:49 simonmar Exp $
+ * $Id: GC.c,v 1.67 1999/11/18 16:02:21 sewardj Exp $
*
* (c) The GHC Team 1998-1999
*
new->link = enteredCAFs;
enteredCAFs = new;
} else {
- ASSERT(0);
+ /* ASSERT(0); */
SET_INFO(caf,&CAF_UNENTERED_info);
caf->value = (StgClosure*)0xdeadbeef;
caf->link = (StgCAF*)0xdeadbeef;