RE: Question on thread safety of objects
RE: Question on thread safety of objects
- Subject: RE: Question on thread safety of objects
- From: Philip Lukidis <email@hidden>
- Date: Thu, 16 Mar 2006 14:20:26 -0500
Thanks a lot, that did the job! You saved me from several hours of toiling
with boilerplate code using mach messages and queues (dealing with timeouts,
which need queuing, etc).
Philip Lukidis
> -----Original Message-----
> From: Nick Zitzmann [mailto:email@hidden]
> Sent: Thursday, March 16, 2006 1:48 PM
> To: Philip Lukidis
> Cc: email@hidden
> Subject: Re: Question on thread safety of objects
>
>
>
> 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