[project @ 2000-08-23 12:51:03 by simonmar]
authorsimonmar <unknown>
Wed, 23 Aug 2000 12:51:03 +0000 (12:51 +0000)
committersimonmar <unknown>
Wed, 23 Aug 2000 12:51:03 +0000 (12:51 +0000)
Fix a problem where ^C wasn't recognised while waiting for I/O.

ghc/rts/Schedule.c
ghc/rts/Select.c

index 39cd819..eaf4d45 100644 (file)
@@ -1,5 +1,5 @@
 /* ---------------------------------------------------------------------------
- * $Id: Schedule.c,v 1.76 2000/08/15 14:18:43 simonmar Exp $
+ * $Id: Schedule.c,v 1.77 2000/08/23 12:51:03 simonmar Exp $
  *
  * (c) The GHC Team, 1998-2000
  *
@@ -514,7 +514,9 @@ schedule( void )
 #endif
        );
     }
-    
+    /* we can be interrupted while waiting for I/O... */
+    if (interrupted) continue;
+
     /* check for signals each time around the scheduler */
 #ifndef mingw32_TARGET_OS
     if (signals_pending()) {
index 79b21ba..0d1a380 100644 (file)
@@ -1,5 +1,5 @@
 /* -----------------------------------------------------------------------------
- * $Id: Select.c,v 1.12 2000/04/03 15:24:21 rrt Exp $
+ * $Id: Select.c,v 1.13 2000/08/23 12:51:03 simonmar Exp $
  *
  * (c) The GHC Team 1995-1999
  *
@@ -171,6 +171,12 @@ awaitEvent(rtsBool wait)
          break;
        }
 
+       if (interrupted) {
+           RELEASE_LOCK(&sched_mutex);
+           select_succeeded = rtsFalse;
+           break;
+       }
+
        /* If new runnable threads have arrived, stop waiting for
         * I/O and run them.
         */
@@ -270,6 +276,6 @@ awaitEvent(rtsBool wait)
        blocked_queue_tl = prev;
       }
 
-    } while (wait && run_queue_hd == END_TSO_QUEUE);
+    } while (wait && !interrupted && run_queue_hd == END_TSO_QUEUE);
 #endif
 }