[project @ 2002-02-15 17:49:23 by sof]
[ghc-hetmet.git] / ghc / rts / Schedule.c
index ba6920b..1f8d06b 100644 (file)
@@ -1,5 +1,5 @@
 /* ---------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.125 2002/02/15 14:49:08 simonmar Exp $
+ * $Id: Schedule.c,v 1.127 2002/02/15 17:49:23 sof Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -3076,6 +3076,7 @@ raiseAsync(StgTSO *tso, StgClosure *exception)
      * top of the CATCH_FRAME ready to enter.
      */
     if (get_itbl(su)->type == CATCH_FRAME && exception != NULL) {
+      StgCatchFrame *cf = (StgCatchFrame *)su;
       StgClosure *raise;
 
       /* we've got an exception to raise, so let's pass it to the
@@ -3090,6 +3091,14 @@ raiseAsync(StgTSO *tso, StgClosure *exception)
        */
       sp = (P_)su - 1;
 
+      /* Ensure that async excpetions are blocked now, so we don't get
+       * a surprise exception before we get around to executing the
+       * handler.
+       */
+      if (tso->blocked_exceptions == NULL) {
+         tso->blocked_exceptions = END_TSO_QUEUE;
+      }
+
       /* Put the newly-built THUNK on top of the stack, ready to execute
        * when the thread restarts.
        */