From 5308c0423b613e0d6a22996e2052731f0a371475 Mon Sep 17 00:00:00 2001 From: Simon Marlow Date: Sun, 13 Dec 2009 20:12:46 +0000 Subject: [PATCH] If ACTIVITY_INACTIVE is set, wait for GC before resetting it I don't think this fixes any real bugs, but there's a small possibility that when the RTS is woken up for an idle-time GC, the IO manager thread might be pre-empted which would prevent the idle GC from happening; this change ensures that the idle GC happens anyway. --- rts/Schedule.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rts/Schedule.c b/rts/Schedule.c index cfdb392..72086e8 100644 --- a/rts/Schedule.c +++ b/rts/Schedule.c @@ -463,7 +463,11 @@ run_thread: if (prev == ACTIVITY_DONE_GC) { startTimer(); } - } else { + } else if (recent_activity != ACTIVITY_INACTIVE) { + // If we reached ACTIVITY_INACTIVE, then don't reset it until + // we've done the GC. The thread running here might just be + // the IO manager thread that handle_tick() woke up via + // wakeUpRts(). recent_activity = ACTIVITY_YES; } #endif -- 1.7.10.4