I currently have a property declared as follows:
@property(atomic, readwrite, retain) MyFrame* latestFrame;

When the value is set, I would like to broadcast a notification on the main 
thread, and one way of doing that would be to write my own custom setter that 
sets the value and then broadcasts the notification. What I am not sure about 
is how much I need to do to ensure this is threadsafe. I have only been able to 
find limited, rather contradictory information on this.

When I write my own setter function, does the "atomic" qualifier have any 
meaning? What I am trying to work out is whether the runtime will bracket my 
function with appropriate locking code, or whether I need to do that myself - 
and so crucially, do I ALSO need to write a custom getter function that is 
subject to the same manual locking?

[I have since wondered whether actually the "right" way of achieving what I 
want is to implement a didChangeValueForKey method from which I do the 
broadcasting. Any comments on that approach would also be welcome!]

Thanks in advance
Jonny_______________________________________________

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