You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Was wondering what people's thoughts are on the GroupOperation cancellation. I'm in a situation where the queue (or GroupOperation directly) gets cancelled. The cancel method on GroupOperation will then cancel all the internal queue operations and finally call super.cancel().
The issue is that the queue delegate may (race condition) finish all the internal operations before super is called. Which means the operationQueue(operationQueue: OperationQueue, operationDidFinish operation: NSOperation, withErrors errors: [NSError]) could trigger (on a separate thread) finish(aggregatedErrors). Then all the observers / didFinishCalls / etc... will get called before the cancelled flag is set.
I'm thinking it only really affects GroupOperation more so than Operation given the way finishingOperation works; but in technically its possible to cancel any operation on a given thread and it finish on another a different on another leading to race conditions and mixed results when notified upon completion and investigating cancelled state.
Was wondering what people's thoughts are on the
GroupOperation
cancellation. I'm in a situation where the queue (orGroupOperation
directly) gets cancelled. The cancel method onGroupOperation
will then cancel all the internal queue operations and finally callsuper.cancel()
.The issue is that the queue delegate may (race condition) finish all the internal operations before super is called. Which means the
operationQueue(operationQueue: OperationQueue, operationDidFinish operation: NSOperation, withErrors errors: [NSError])
could trigger (on a separate thread)finish(aggregatedErrors)
. Then all the observers / didFinishCalls / etc... will get called before the cancelled flag is set.I'm thinking it only really affects
GroupOperation
more so thanOperation
given the way finishingOperation works; but in technically its possible to cancel any operation on a given thread and it finish on another a different on another leading to race conditions and mixed results when notified upon completion and investigating cancelled state.My proposal:
Change
To
That way when the internal queue finishes cancelling all the individual operations the overall
GroupOperation
will be properly marked cancelledThe text was updated successfully, but these errors were encountered: