'From Squeak3.9 of 7 November 2006 [latest update: #7067] on 31 July 2007 at 4:17:35 pm'! "Change Set: FreezeFix Date: 31 July 2007 Author: Adrian Lienhard Fixes image freeze problem (see Mantis #6581) by forcing a complete delay of 50ms between each UI cycle"! !Preferences class methodsFor: 'standard queries' stamp: 'al 7/31/2007 16:17'! serverMode ^ self valueOfFlag: #serverMode ifAbsent: [false]! ! !WorldState methodsFor: 'update cycle' stamp: 'al 7/31/2007 16:12'! interCyclePause: milliSecs "delay enough that the previous cycle plus the amount of delay will equal milliSecs. If the cycle is already expensive, then no delay occurs. However, if the system is idly waiting for interaction from the user, the method will delay for a proportionally long time and cause the overall CPU usage of Squeak to be low. If the preference #serverMode is enabled, always do a complete delay of 50ms, independant of my argument. This prevents the freezing problem described in Mantis #6581" | currentTime wait | Preferences serverMode ifFalse: [ (lastCycleTime notNil and: [CanSurrenderToOS ~~ false]) ifTrue: [ currentTime := Time millisecondClockValue. wait := lastCycleTime + milliSecs - currentTime. (wait > 0 and: [ wait <= milliSecs ] ) ifTrue: [ (Delay forMilliseconds: wait) wait ] ] ] ifTrue: [ (Delay forMilliseconds: 50) wait ]. lastCycleTime := Time millisecondClockValue. CanSurrenderToOS := true.! ! Preferences addPreference: #serverMode category: 'unclassified' default: false balloonHelp: 'If the preference #serverMode is enabled, always do a complete delay of 50ms, independant of my argument. This prevents the freezing problem described in Mantis #6581'. !