I have an NSOperation with an NSOperationQueue that has a bunch of child operations, some queued up.
I had a problem where even after calling cancelAllOperations on the queue my main method was hanging on waitUntilAllOperationsAreFinished.
Then when I set the complete flag I use for isFinished upon cancellation it no longer gets backed up in a cancelled queue.
- (BOOL)isFinished
{
return complete;
}
- (void)cancel
{
cancelled = YES;
complete = YES;
[_childOperationQueue cancelAllOperations];
}
Is this the correct behaviour, a cancelled operation should be technically finished? It seems like NSOperation needs the isFinished to be set to true before it will remove it, in thought this might allow it to 'clean up', but I don't know what the protocol is here and google didn't reveal much.