Re: Thread-safe atomic property for array
Re: Thread-safe atomic property for array
- Subject: Re: Thread-safe atomic property for array
- From: Sandy McGuffog <email@hidden>
- Date: Sat, 15 Aug 2015 15:50:18 +0200
Well, in my experience, in multithreaded code, if you can’t guarantee that something won’t happen, sooner or later it will, so you better code around it. Murphy’s law is particularly strong as regards multithreading :)
> On Aug 15, 2015, at 2:36 PM, Mike Abdullah <email@hidden> wrote:
>
>
>> On 15 Aug 2015, at 13:21, Sandy McGuffog <email@hidden> wrote:
>>
>> What guarantees that the current autorelease cycle doesn’t end in the middle of this code?
>
> If it does end in the middle of this code, that’s something the author of the code is doing specially and must deal with the consequences by themselves. Trying to protect against that in general is futile.
>>
>> Actually, as I think about it, technically, the [[hostObject myArray] retain] should be wrapped in some kind of lock mechanism itself to make it atomic….
>
> Go back and read the question. The OP explicitly states that this is an atomic property, and they don’t care if the results are a bit out of date. No extra locking required.
>
_______________________________________________
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