Thread debugging gotchas and suggestions (was: Re: REPOSTING: SharedQueue question???)

Ned Konz ned at bike-nomad.com
Fri Oct 27 03:56:27 UTC 2000


And remember that Morphic is not particularly thread-safe (that is,
it runs in a single thread, and doesn't know or care about any others).

Making Morphic wait on a SharedQueue in, say, a step method is not a good idea
(because it can kill your UI).
Nor is calling methods on a Morph from another thread (like, for instance,
writing to the Transcript).

You can display status messages from threads by writing to simple variables
in your objects, and then display them using, say, an Inspector, or an
UpdatingStringMorph (borrowing from Bob's earlier post):

(UpdatingStringMorph on: myActiveObject selector: #statusMessage) 
        font: ((TextStyle default fontOfSize: 24) emphasized: 1);
        stepTime: 1000;
        openInWorld 

where myActiveObject is an instance of a class that defines statusMessage
as a simple accessor of an instance variable.

The Transcript is (at least without some tweaks that have been posted
to the list) _not_ a good place to put thread debugging information.

The debugger works with threads in 2.9a (yay, this got fixed!).

-- 
Ned Konz
currently: Stanwood, WA
email:     ned at bike-nomad.com
homepage:  http://bike-nomad.com





More information about the Squeak-dev mailing list