Re: properties implementation
Re: properties implementation
- Subject: Re: properties implementation
- From: Jens Alfke <email@hidden>
- Date: Tue, 22 Apr 2008 08:10:23 -0700
On 22 Apr '08, at 6:38 AM, Michael Vannorsdel wrote:
I believe if you use the nonatomic attribute it will be the first
example, for atomic it's the second. Atomic is the default if not
specified.
And atomic setters are even more complicated, as they incorporate a
lock, to avoid race conditions when two threads try to set the
property at the same time.
The sad thing is that this makes synthesized property accessors much
more expensive than is generally necessary, unless you manually add
the "nonatomic" attribute to each one. (I say "generally" because most
Cocoa application code isn't multithreaded, and even thread-safe code
requires synchronization to be done at a level higher than individual
property values, so it probably has its own synchronization code as
well.)
—Jens
Attachment:
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________
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