« Return to Thread: Re: CPU usage

Re: Re: CPU usage

by Fournier Eric :: Rate this Message:

Reply to Author | View in Thread

Nice. I had to change the order (it refused to return to morphic if  
the delay came after island>>scheduler>>run).

Thanks a bunch Bert!

-- Eric



On Jan 13, 2006, at 11:55 AM, Bert Freudenberg wrote:

>
> The Morphic main-loop gives up time to the OS if there isn't much  
> to do. CTweakProjectInMorphic>>run: doesn't. But it could:
>
> run
> | lastCycleTime pause currentTime wait |
> lastCycleTime := Time millisecondClockValue.
> pause := 50.
> island project canvas: (CTransformCanvas on: Display).
> island project world extent: Display extent.
> [done] whileFalse:[
> self checkForNewScreenSize.
> island scheduler run.
>
> currentTime := Time millisecondClockValue.
> wait := lastCycleTime + pause - currentTime.
> (wait > 0 and: [ wait <= pause ])
> ifTrue: [ (Delay forMilliseconds: wait) wait ].
> lastCycleTime := currentTime.
> ].
>
> uiProcess == Processor activeProcess ifTrue:[uiProcess := nil].
>
>
> - Bert -
>
> _______________________________________________
> Tweak mailing list
> Tweak@...
> http://impara.de/mailman/listinfo/tweak

_______________________________________________
Tweak mailing list
Tweak@...
http://impara.de/mailman/listinfo/tweak

 « Return to Thread: Re: CPU usage