• 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: GC and atomic getters/setters
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: GC and atomic getters/setters


  • Subject: Re: GC and atomic getters/setters
  • From: Bill Bumgarner <email@hidden>
  • Date: Sat, 17 Oct 2009 09:18:27 -0700


On Oct 17, 2009, at 8:38 AM, BJ Homer wrote:

But assuming that you
wanted it there in the first place, why does the GC version not need the
synchronization?

Under GC, object reference assignments -- scanned pointer assignments, technically -- are, in and of themselves, atomic. Note that structures will still require atomicity protection in GC, if desired (though, yes, property level atomicity is generally the wrong answer for ensuring thread safety).


In non-gc, the need to send some combination of -retain/-release/- autorelease method calls leaves a window within which a caller may get a hold of an object reference that is about to be released in another thread. Thus, the need to use some form of locking or synchronization primitive to ensure that this doesn't happen.

As Kai said, GC's natural atomicity in object assignment is a distinct advantage. In particular, it makes concurrent programming a bit less tricky as there is no need to play retain-on-one-thread-to-release-on- another-thread games.

b.bum
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: GC and atomic getters/setters
      • From: Michael Ash <email@hidden>
References: 
 >GC and atomic getters/setters (From: BJ Homer <email@hidden>)

  • Prev by Date: Re: GC and atomic getters/setters
  • Next by Date: Re: Subclassing a view class from an external framework
  • Previous by thread: Re: GC and atomic getters/setters
  • Next by thread: Re: GC and atomic getters/setters
  • Index(es):
    • Date
    • Thread