Re: Question on thread safety of objects
Re: Question on thread safety of objects
- Subject: Re: Question on thread safety of objects
- From: Nick Zitzmann <email@hidden>
- Date: Thu, 16 Mar 2006 11:47:56 -0700
On Mar 16, 2006, at 11:36 AM, Philip Lukidis wrote:
For now, the
notification information is converted to a string, and sent to a
NSTextView.
However, I think that I've blundered into threadsafe issues here,
because it
fails right away on a dual G5, and much less frequently on my
single CPU dev
machine. For now I use CFMessagePorts to send a message to the
main thread,
and when I update the NSTextView in this thread, I have no crashes.
Is there a simpler way?
NSTextView isn't thread-safe, so you must message it from the main
thread. However, you don't really need to use CFMessagePort to send
messages to the main thread unless you're targeting users who are
still using ancient versions of Mac OS X. Instead, use the -
performSelectorOnMainThread: methods that are defined in NSObject.
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden