Re: Child threads and the UI
Re: Child threads and the UI
- Subject: Re: Child threads and the UI
- From: Chris Gehlker <email@hidden>
- Date: Wed, 24 Oct 2001 11:45:26 -0700
On 10/23/01 3:03 PM, "Peter Ammon" <email@hidden> wrote:
>
On Monday, October 22, 2001, at 04:09 PM, Chris Gehlker wrote:
>
>
> I'm working on a program that does cel animation. Building a Movie can
>
> take
>
> awhile and I want to show a progress bar while the program is looping
>
> through frames. Looking through the archives of this list, I found that
>
> the
>
> canonical approach is to launch a thread to do the animation and to use
>
> DO
>
> to report progress back to the main thread which runs the progress bar.
>
> The
>
> canonical way works.
>
>
>
> But it also seems to work if I just let the daughter thread own the
>
> NSProgressIndicator and the NSPanel that it's displayed in. This also
>
> seems
>
> like cleaner code because none of the methods in the main thread need to
>
> know anything about the progress bar.
>
>
>
> I'm just worried that I may be setting myself up for a fall by going
>
> down
>
> this path. Am I missing something?
>
>
What happens if you attempt to update the status of the
>
NSProgressIndicator while it is in its display: method? Bad stuff could
>
happen.
It doesn't seem too, but, thanks to you and those who responded privately
I'm convinced that I just happened to stumble on a thread-safe piece of
AppKit. I've gone back to letting the primary thread handle everything in
the UI.
--
Cogito Ergo Spud. - I think therefore I yam.