diff options
Diffstat (limited to 'rts/Schedule.c')
-rw-r--r-- | rts/Schedule.c | 35 |
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) |