Re: Messed up NSTextField labels - thread issue?
Re: Messed up NSTextField labels - thread issue?
- Subject: Re: Messed up NSTextField labels - thread issue?
- From: Brendan Younger <email@hidden>
- Date: Thu, 7 Jun 2001 00:17:31 -0500
I thank you for the chuckles I got when reading your post (friendly
ones, mind you). Yes, many of the AppKit's classes are not
thread-safe. Since I have just recently been brought into the light as
to how to deal with the threading issues, I am more than eager to impart
what I've learned.
As far as updating UI elements goes, I've been advised that ports and
distributed objects are you're best bet for communicating with the main
thread (the one with the run loop) and allowing all drawing to be done
through it (the main thread). For ports, Raphael Sebbe has an article
on StepWise (www.stepwise.com) which deals with the SpeechUtilities
framework, and it uses a port to communicate with the spawned thread.
Distributed Objects are discussed in
http://developer.apple.com/techpubs/macosx/Cocoa/TasksAndConcepts/ProgrammingTopics/
DistrObjects/index.html. There is also an example called
MultithreadedDO in the Foundation examples from the Developer Tools CD.
There are, however, some AppKit classes that are thread safe (at least
somewhat) and these are detailed at
http://developer.apple.com/techpubs/macosx/ReleaseNotes/ThreadSupport.html.
Good luck!
Brendan Younger