summaryrefslogtreecommitdiff
path: root/rts/Schedule.c
diff options
context:
space:
mode:
authorSimon Marlow <marlowsd@gmail.com>2008-11-06 15:53:56 +0000
committerSimon Marlow <marlowsd@gmail.com>2008-11-06 15:53:56 +0000
commit48685b251fcfcd1295c779a01de724122e312cf5 (patch)
tree8ee6e203bde226bea8e99b7f2bd6361e3d054db7 /rts/Schedule.c
parentc039455d1b81687d395617a43aeea67c31b34b9f (diff)
downloadhaskell-48685b251fcfcd1295c779a01de724122e312cf5.tar.gz
don't yield if the system is shutting down
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r--rts/Schedule.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index 8c2c3def17..63e2e99f06 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -700,7 +700,9 @@ shouldYieldCapability (Capability *cap, Task *task)
// - we need to yield this Capability to someone else
// (see shouldYieldCapability())
//
-// The return value indicates whether
+// Careful: the scheduler loop is quite delicate. Make sure you run
+// the tests in testsuite/concurrent (all ways) after modifying this,
+// and also check the benchmarks in nofib/parallel for regressions.
static void
scheduleYield (Capability **pcap, Task *task)
@@ -709,7 +711,9 @@ scheduleYield (Capability **pcap, Task *task)
// if we have work, and we don't need to give up the Capability, continue.
if (!shouldYieldCapability(cap,task) &&
- (!emptyRunQueue(cap) || blackholes_need_checking))
+ (!emptyRunQueue(cap) ||
+ blackholes_need_checking ||
+ sched_state >= SCHED_INTERRUPTING))
return;
// otherwise yield (sleep), and keep yielding if necessary.