+/* Counter holding the number of timer ticks seen during GC */
+I_ delayTicks = 0;
+
+/*
+ handleTimerExpiry is used to temporarily delay the handling of
+ timer ticks for threads delayed waiting for timeout. Disable
+ during GC, counting up the ticks , before updating the waiting
+ threads queue when finished GCing.
+
+ */
+
+void
+handleTimerExpiry(enable)
+rtsBool enable;
+{
+ /*
+ If we enable the handling of timer expiry, update the WaitingThreads
+ queue with the number of ticks we have accumulated since the handling
+ was disabled.
+ */
+ if (!enable)
+ delayTicks = 1;
+ else {
+ if (delayTicks > 1) {
+ delayTicks = 0;
+ AwaitEvent((delayTicks-1) * RTSflags.ConcFlags.ctxtSwitchTime);
+ }
+ }
+}
+