Re: [[NSFileManager alloc] init] considered thread-safe
Re: [[NSFileManager alloc] init] considered thread-safe
- Subject: Re: [[NSFileManager alloc] init] considered thread-safe
- From: Ken Ferry <email@hidden>
- Date: Tue, 4 May 2010 23:37:49 -0700
On Tue, May 4, 2010 at 11:27 PM, Quincey Morris <email@hidden
> wrote:
> On May 4, 2010, at 22:32, Ken Ferry wrote:
>
> > Jens is exactly right.
> >
> > If you are going to use the delegate, you must make your own instance of
> NSFileManager. Clearly - if you did that with the shared manager, you and
> other threads would fight over it.
> >
> > NSFileManager is otherwise threadsafe. There's an open bug to rev the
> docs.
> >
> > -Ken
>
> Sorry if I'm being dense, but I seem to keep getting an ambiguous answer to
> the real question. :)
I'm not concerned with the issue of delegates. My question is whether a
> single (delegate-less) instance of NSFileManager can be used simultaneously
> from multiple threads, or whether each thread needs a separate instance to
> prevent conflicts but multiple instances don't conflict with each other
> though they share the filesystem. Both possibilities are a kind of thread
> safety.
>
You can use a single instance from multiple threads, generally the shared
one.
Delegates are the only reason the doc says anything other than "go nuts".
This is what both Jens and I were trying to say.
-Ken
Cocoa Frameworks
>
> I thought "thread-safe" meant the former. Jens and some historical
> commentary said the latter for NSFileManager. You just said "thread-safe",
> but I'm not sure *which* thread-safe you meant -- the former or the latter.
>
>
> _______________________________________________
>
> 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
>
_______________________________________________
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