I am trying to implement an operation queue and I have the following scenario:
NSOperation A
NSOperation B
NSOperation C
NSOperation D
NSOperationQueue queue
Once an NSOperation is in its main method you have to go through with it. There is no paused state, only finished or cancelled.
I would implement a NSCopying on operation A which would copy the entire state into a new instance. You would have a delegate method or block which is able to communicate that this operation cannot go through because it is missing info from operation B.
So the process would go such:
Inside the delegate you have to make sure to suspend the queue to avoid a race condition. After the above steps you resume the queue. In operation A you would have multiple places where you check for isCancelled to actually not do any more work in main when it has been cancelled.