NSOperation cancellation
NSOperation cancellation
- Subject: NSOperation cancellation
- From: Thomas Engelmeier <email@hidden>
- Date: Mon, 25 May 2009 19:15:44 +0200
Hi,
I'm running into some trouble with NSOperation / NSOperationQueue.
In order to tear down everything gracefully, I use something like
[queue cancelAllOperations];
[queue waitUntilAllOperationsAreFinished];
My NSOperation subclasses just have a straightforward -(void) main
method.
It works as advertised for me unless I'm trying to cancel the
operations.
Regular run:
(MyOperation) change of isExecuting to 1
(MyOperation) change of isExecuting to 0
(MyOperation) change of isFinished to 1
Cancel run:
(MyOperation) change of isExecuting to 1
** Cancel...
(MyOperation) change of isCancelled to 1
My op polls isCancelled, returns from main and nothing more happens.
op.isFinished and op.isExecuting is not updated, bringing
waitUntilAllOperationsAreFinished and other KVC observers to an halt.
Do I really need to reimplement the whole state (isFinished,
isExecuting) logic just in order to support cancellation?
TIA,
Tom_E
_______________________________________________
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