Multithreading
Ned Konz
ned at squeakland.org
Sat Mar 26 15:25:11 UTC 2005
On Friday 25 March 2005 5:29 pm, Daniel Salama wrote:
> I'm experiencing a bit of a problem with a simple task I'm doing. I'm
> trying to read a file and print something in the Transcript window
> while reading the file. The problem I find is that while Squeak is
> reading the file, the VM dedicates 100% of its processor time to that
> task. On the same VM, I'm running Seaside, so while the VM is reading
> the file, Seaside cannot render any pages. Any suggestions on how to
> overcome this problem?
First, don't write to the Transcript directly from a non-UI task, as this
isn't guaranteed to work correctly. If you *must* write to the transcript
from a non-UI task, then:
* only do it using #addDeferredUIMessage: like this:
WorldState addDeferredUIMessage: [ Transcript nextPutAll: someString;
nextPutAll: 'something else'; cr ].
* use nextPutAll: instead of show:
* if you must force the output to be visible (which takes more CPU time
because the screen must be updated), then call endEntry .
Second, try to break up the writing by waiting on a Delay, and/or reduce the
priority of the reading thread to equal or less than the priority of the
Seaside threads.
--
Ned Konz
http://bike-nomad.com/squeak/
More information about the Squeak-dev
mailing list
|