summaryrefslogtreecommitdiff
path: root/rts/Schedule.c
diff options
context:
space:
mode:
authorIan Lynagh <ian@well-typed.com>2012-08-08 13:09:41 +0100
committerIan Lynagh <ian@well-typed.com>2012-08-08 13:09:41 +0100
commit415598b232f6664fb4da8321f5f578405af245de (patch)
tree2443f8fe50b1badc77c8b055bcebd8d20dadf0a8 /rts/Schedule.c
parentc2a532a84ea43c7ea3a5a6d29d66914d41b56156 (diff)
parent1edad871a1bd144a825139670bfdd4352d3f7f73 (diff)
downloadhaskell-415598b232f6664fb4da8321f5f578405af245de.tar.gz
Merge branch 'master' of darcs.haskell.org:/srv/darcs//ghc
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r--rts/Schedule.c35
1 files changed, 22 insertions, 13 deletions
diff --git a/rts/Schedule.c b/rts/Schedule.c
index dee71c4676..310e68e629 100644
--- a/rts/Schedule.c
+++ b/rts/Schedule.c
@@ -1658,21 +1658,30 @@ delete_threads_and_gc:
traceSparkCounters(cap);
- if (recent_activity == ACTIVITY_INACTIVE && force_major)
- {
- // We are doing a GC because the system has been idle for a
- // timeslice and we need to check for deadlock. Record the
- // fact that we've done a GC and turn off the timer signal;
- // it will get re-enabled if we run any threads after the GC.
- recent_activity = ACTIVITY_DONE_GC;
- stopTimer();
- }
- else
- {
+ switch (recent_activity) {
+ case ACTIVITY_INACTIVE:
+ if (force_major) {
+ // We are doing a GC because the system has been idle for a
+ // timeslice and we need to check for deadlock. Record the
+ // fact that we've done a GC and turn off the timer signal;
+ // it will get re-enabled if we run any threads after the GC.
+ recent_activity = ACTIVITY_DONE_GC;
+ stopTimer();
+ break;
+ }
+ // fall through...
+
+ case ACTIVITY_MAYBE_NO:
// the GC might have taken long enough for the timer to set
- // recent_activity = ACTIVITY_INACTIVE, but we aren't
- // necessarily deadlocked:
+ // recent_activity = ACTIVITY_MAYBE_NO or ACTIVITY_INACTIVE,
+ // but we aren't necessarily deadlocked:
recent_activity = ACTIVITY_YES;
+ break;
+
+ case ACTIVITY_DONE_GC:
+ // If we are actually active, the scheduler will reset the
+ // recent_activity flag and re-enable the timer.
+ break;
}
#if defined(THREADED_RTS)