Werner Kassens wrote:
Hi,
i ran a program that did some calculations for about an hour. in between i occasionally moved the cursor (so that the computer did not go to sleep) and probably clicked occasionally on the browser. after some time this resulted in several errors from the browser (the program itself does nothing with the browser). when i tried to reproduce this, the program ran flawlessly (i retried it in 4.0., as i thought it happened there but perhaps it happened in 3.0, and btw it was much faster in 4.0 than in earlier versions). now i wonder whether i should regularly cede some time to other processes, and if yes, how does one do that?
werner



Just to be clear, by "did some calculations for an hour" do you mean the Image basically locked up during the calculation, and the mouse clicks were queued until the calculation ended?

Anyhow, there are two general approaches I am familiar with.
1. Add " Processor yield " within your calculation loop.
2. Run your calculation at a priority lower than the UI. For example, " result := nil. calculationProcess := [ result := self myCalculation ] forkAt: Processor userBackgroundPriority " , then periodically test for " result ~= nil " , maybe from a "step" method in your own subclass of some Morph.

cheers -ben

Reply via email to