Re: [[NSFileManager alloc] init] considered thread-safe
Re: [[NSFileManager alloc] init] considered thread-safe
- Subject: Re: [[NSFileManager alloc] init] considered thread-safe
- From: Michael Ash <email@hidden>
- Date: Wed, 5 May 2010 14:33:47 -0400
On Wed, May 5, 2010 at 2:29 PM, Jens Alfke <email@hidden> wrote:
>
> On May 5, 2010, at 8:50 AM, Michael Ash wrote:
>
>>> Delegates are the only reason the doc says anything other than "go nuts".
>>> This is what both Jens and I were trying to say.
>>
>> Is this true for all OS X versions, for 10.6+, or some other combination?
>
> For all, I think, although the issue doesn’t apply prior to 10.5 because there wasn’t a delegate. Aside from the delegate, NSFileManager is really just a stateless procedural API wrapped up in an object instance, so it has the same thread safety as the underlying filesystem calls, i.e. “go nuts”.
That's what I would have thought, but it was explicitly listed as not
being thread safe before 10.5, and is still listed as "v10.5 and
later" next to the entry that marks it as thread safe in the Cocoa
thread safety summary.
Just because the API is stateless doesn't mean the object itself
doesn't have any state underneath. It *shouldn't*, but I'd tend to
trust the API docs.
However, I'm only targeting 10.5 these days, and that doc answers my
question, so I'm in good shape! I should have looked there first.
Mike
_______________________________________________
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