• 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: NSThread call back...
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSThread call back...


  • Subject: Re: NSThread call back...
  • From: Chris Hanson <email@hidden>
  • Date: Wed, 9 Nov 2005 22:25:29 -0800

On Nov 9, 2005, at 10:02 PM, Dustin Voss wrote:

If it does UI, directly or indirectly, it should be executed in the main thread's context. If it just adjusts data values, it can be executed in any thread context, but you'll have to provide some sort of locking mechanism if you don't use the main thread context.

It's a little more complicated than that. If what you want to do involves changing properties that are used in bindings or are otherwise being observed via Key-Value Observing, that must be done on the main thread because KVO is not thread-safe.


This is part of why there is a strong suggestion to Core Data users to use a separate NSManagedObjectContext and set of objects per thread. If you do that, then you're minimizing the risk that you'll have managed objects that are bound to but also being manipulated in some other thread.

  -- Chris

_______________________________________________
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: 
 >NSThread call back... (From: "Brian O'Brien" <email@hidden>)
 >Re: NSThread call back... (From: Dustin Voss <email@hidden>)

  • Prev by Date: Re: NSThread call back...
  • Next by Date: Re: refreshing the header title for an NSTableColumn
  • Previous by thread: Re: NSThread call back...
  • Next by thread: Fwd: NSThread call back...
  • Index(es):
    • Date
    • Thread