Re: Threadsafe copy of objective c object
Re: Threadsafe copy of objective c object
- Subject: Re: Threadsafe copy of objective c object
- From: Markus Spoettl <email@hidden>
- Date: Tue, 03 Sep 2013 14:26:17 +0200
On 9/3/13 1:23 PM, Jonathan Taylor wrote:
- True thread safety would require a copy that represents an instantaneous
snapshot of the state of the entire object, i.e. copy not taken while object
is being updated. Actually, I suspect this last condition is not a problem
for my specific case, but best to be on the safe side, for several different
reasons.
That means you have to make the copy and write accesses to the individual
properties mutually exclusive. Depending on the number of properties in your
object, it might be easier to completely exchange the object whenever you want
to mutate one if its properties, basically treating the whole object immutable.
Copying is trivial then. Of course it depends on how many times a second you
need to change properties.
Regards
Markus
--
__________________________________________
Markus Spoettl
_______________________________________________
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