If ACTIVITY_INACTIVE is set, wait for GC before resetting it
authorSimon Marlow <marlowsd@gmail.com>
Sun, 13 Dec 2009 20:12:46 +0000 (20:12 +0000)
committerSimon Marlow <marlowsd@gmail.com>
Sun, 13 Dec 2009 20:12:46 +0000 (20:12 +0000)
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

index cfdb392..72086e8 100644 (file)
@@ -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