• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question on thread safety of objects
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Question on thread safety of objects (From: Philip Lukidis <email@hidden>)

  • Prev by Date: Re: Accessing window back buffer without deprecated functions in Tiger
  • Next by Date: Re: Subclassing a NSMutableArray
  • Previous by thread: Question on thread safety of objects
  • Next by thread: RE: Question on thread safety of objects
  • Index(es):
    • Date
    • Thread