Re: ivar access during -finalize
Re: ivar access during -finalize
- Subject: Re: ivar access during -finalize
- From: Quincey Morris <email@hidden>
- Date: Thu, 08 Mar 2012 13:40:32 -0800
On Mar 8, 2012, at 09:09 , Nick Zitzmann wrote:
> +defaultManager is not thread-safe IIRC.
It's currently listed as thread-safe:
https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Multithreading/ThreadSafetySummary/ThreadSafetySummary.html
I believe there was historically some confusion because the safety characteristics changed in 10.5, and the documentation didn't properly reflect the post-10.5 behavior. There were 2 separate safety issues:
1. Is NSFileManager atomically safe? That is, can you safely use a single instance from multiple threads without confusing the instance.
2. Is NSFileManager thread safe? Can you safely use multiple instances from multiple threads without (say) running into a file system deadlock.
If #2 wasn't true, you'd have to use instances other than [NSFileManager defaultManger] with extreme care. If #1 wasn't true, you'd have use a different instance in each thread, or implement your own atomic lock.
I believe #1 wasn't true pre-10.5, but it was hard to know for sure because most information on the subject didn't properly distinguish between atomicity and thread safety.
_______________________________________________
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