'From Squeak3.1alpha of 7 March 2001 [latest update: #3987] on 6 May 2002 at 5:03:06 pm'! "Change Set: CheckForDelayJMM Date: 6 May 2002 Author: John M McIntosh Tamper with idleProcess so that the relinquishProcessorForMicroseconds: is capped at 1 second and an attempt is made to make the time we sleep equal to the time until the next active Delay. VM should wake up early if a user or network event occurs. Thus CPU usage should go down, and Delay accuracy should go up"! !Delay class methodsFor: 'testing'! nextWakeUpTime ^ AccessProtect critical: [ActiveDelay isNil ifTrue: [0] ifFalse: [ActiveDelay resumptionTime]]! ! !ProcessorScheduler class methodsFor: 'background process'! idleProcess | t1 t2 t3 t4 | t1 _ t2 _ 0. t4 _ Time millisecondClockValue. [true] whileTrue: [t3 _ Time millisecondClockValue. t2 _ t3 - t4 - t1 max: 0. t1 _ Delay nextWakeUpTime - t3 - t2. t1 _ 1000 min: t1. t1 > 1 ifTrue: [self relinquishProcessorForMicroseconds: t1 * 1000]. t4 _ t3]! !