• 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: Thread safety of Cocoa Bindings
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Thread safety of Cocoa Bindings


  • Subject: Re: Thread safety of Cocoa Bindings
  • From: Felix Schwarz <email@hidden>
  • Date: Mon, 5 Dec 2005 16:57:22 +0100

Just to answer my posting in parts myself: it seems that, if I modify a KVO/KVC-compliant array in a background thread, Cocoa makes sure the UI is updated in a thread-safe manner. This is shown to me by some debug code that prints the MPTask id of the background thread while adding to the array and the print out of the MPTask id when the value of the object is accessed:

Addentry: -1610551960 // Adding of some demo data from the main thread
Addentry: -1610551960
Addentry: -1610551960
attribute: -1610551960 // Initial accesses to the attribute of the objects in the array
attribute: -1610551960
attribute: -1610551960
attribute: -1610551960
attribute: -1610551960
attribute: -1610551960
Addentry: 25493504 // Async adding of a record to the array in a background thread
attribute: -1610551960 // Access to the attribute by Cocoa Bindings
attribute: -1610551960
attribute: -1610551960
attribute: -1610551960

However, I still wonder: are there parts of Cocoa bindings, that are not thread safe?

Felix

Am 05.12.2005 um 12:55 schrieb Felix Schwarz:

Hi,

I'm still in the process of evaluating Cocoa bindings and have been very impressed with what I have been able to do with them so far.

However, one thing I'm wondering, is whether Cocoa bindings are entirely thread-safe:

Since AppKit is supposed to be not thread-safe and i.e. changing an object in a background thread in a KVO/KVC compliant way should trigger an update in the UI.

Would this update in the UI then be executed on the main thread or on the background thread (and probably crash)?

Would I have to use proxy objects to ensure thread-safety of Cocoa bindings?

Thanks in advance for all answers. This information is really important for me.

Felix

_______________________________________________
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: 
 >Thread safety of Cocoa Bindings (From: Felix Schwarz <email@hidden>)

  • Prev by Date: Repost: More NSBrowser/NSTreeController bugs
  • Next by Date: Re: resize image with cocoa
  • Previous by thread: Thread safety of Cocoa Bindings
  • Next by thread: Re: Thread safety of Cocoa Bindings
  • Index(es):
    • Date
    • Thread