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 (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to