• 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: nonatomic vs atomic assign/retain
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: nonatomic vs atomic assign/retain


  • Subject: Re: nonatomic vs atomic assign/retain
  • From: Joar Wingfors <email@hidden>
  • Date: Tue, 06 Sep 2011 09:09:31 -0700

On 6 sep 2011, at 08:49, Thomas Davie wrote:

> There are two schools of thought on atomic/nonatomic, and both apply equally to Mac/iOS:
>
> 1) Atomicity provides a little bit of safety, and shouldn't be shrugged off for no reason.  Because of that, only optimise the atomic set/get when you've actually profiled and determined it's a problem.


There's an additional consideration to keep in mind - @synthesized getters use the retain+autorelease pattern which makes local variables acquired from such getters "safer" in certain (unusual) usage patterns. Nothing to do with thread safety - of course.


> 2) When multithreading you rarely if ever actually want atomicity at the property level, instead you want somewhat larger critical sections in general.


Wholeheartedly agree.


j o a r


_______________________________________________

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: nonatomic vs atomic assign/retain
      • From: Torsten Curdt <email@hidden>
    • Re: nonatomic vs atomic assign/retain
      • From: Jens Alfke <email@hidden>
References: 
 >nonatomic vs atomic assign/retain (From: Torsten Curdt <email@hidden>)
 >Re: nonatomic vs atomic assign/retain (From: Thomas Davie <email@hidden>)

  • Prev by Date: Re: nonatomic vs atomic assign/retain
  • Next by Date: using AppKit additions in background threads
  • Previous by thread: Re: nonatomic vs atomic assign/retain
  • Next by thread: Re: nonatomic vs atomic assign/retain
  • Index(es):
    • Date
    • Thread