Re: pointer assignment inherently atomic ?
Re: pointer assignment inherently atomic ?
- Subject: Re: pointer assignment inherently atomic ?
- From: Uli Kusterer <email@hidden>
- Date: Sat, 11 Aug 2007 00:04:06 +0200
On 10.08.2007, at 23:54, Uli Kusterer wrote:
And anyway, you'll need a lock anyway, because someone could be
accessing the array from another thread while you're replacing it,
and then you'd release it from out under their feet. Also keep in
mind that you also have to lock the objects *in* the array if
they're mutable and accessed from another thread, or if they could
get released on one of the threads.
Errr... not clear enough: What I meant is that you need to lock the
object containing the array (so you can change or examine the iVar
pointing to the array), the array (so you don't release it while
someone else is iterating over it or whatever) and the objects in the
array. The latter is not necessary for immutable objects, of course.
Cheers,
-- M. Uli Kusterer
http://www.zathras.de
_______________________________________________
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