Re: async NSOperation and NSOperationQueue
Re: async NSOperation and NSOperationQueue
- Subject: Re: async NSOperation and NSOperationQueue
- From: Quincey Morris <email@hidden>
- Date: Mon, 15 Sep 2008 15:18:10 -0700
On Sep 15, 2008, at 14:35, Ken Thomases wrote:
It's possible that it's not safe to release a NSOperation until
after it returns YES to [NSOperation isFinished].
I don't think there needs to be anything specific in the
documentation. In the absence of a documented exception, we should
assume it follows the usual Cocoa memory management conventions.
That is, if you need to continue to access the NSOperation, you need
to hold ownership of it. If you don't care about accessing it in
the future, you need not. The NSOperationQueue is expected to do
whatever is necessary for it to carry out its responsibilities. If
it needs to retain the NSOperation objects, and we can guess that it
probably does need that, it will. You, as a client, shouldn't care
though.
The question is not really about what NSOperationQueue does, but
whether it's safe to release a NSOperation while it's executing. If
not (as seems likely), then even if you don't otherwise care about
accessing it in the future, you must not release it until 'isFinished'
returns YES.
In the absence of documented details, therefore, you can neither rely
on NSOperationQueue to keep it alive nor release it yourself until
it's finished, which is a bit more restrictive than what you said above.
_______________________________________________
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