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 protected]> wrote:
> 
> 
>> On 15 Aug 2015, at 13:21, Sandy McGuffog <[email protected]> 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 protected])

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to