+ 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.
+ //
+ // Note: this is done before GC, because after GC there might
+ // be threads already running (GarbageCollect() releases the
+ // GC threads when it completes), so we risk turning off the
+ // timer signal when it should really be on.
+ recent_activity = ACTIVITY_DONE_GC;
+ stopTimer();
+ }
+