Re: Child threads and the UI
Re: Child threads and the UI
- Subject: Re: Child threads and the UI
- From: Rainer Brockerhoff <email@hidden>
- Date: Thu, 25 Oct 2001 09:04:06 -0200
Date: Wed, 24 Oct 2001 11:45:26 -0700
From: Chris Gehlker <email@hidden>
On 10/23/01 3:03 PM, "Peter Ammon" <email@hidden> wrote:
> 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.
I'm doing multithreaded UI without any "bad stuff" so far by:
- starting new threads with [NSApplication
detachDrawingThread:toTarget:withObject:];
- making sure only one single thread updates a given view.
In one single case I have a popup button which may be accessed by two
threads, I'm bracketing all accesses of the button with
lockFocusIfCanDraw and unlockFocus calls - which seems to
successfully avoid problems.
YMMV,
--
Rainer Brockerhoff <email@hidden>
Belo Horizonte, Brazil
"Originality is the art of concealing your sources."
http://www.brockerhoff.net/ (updated Oct. 2001)