I have an NSOperationQueue to which i have added my custom class’s objects(inherits from NSOperation) i have set the “setMaxConcurrentOperationCount” to be 1. But when i cancel all the operations like this:
[mOperationQueue cancelAllOperations];
it takes about 10 -15 seconds sometimes to cancel them all.
NSOperationQueue contains about 60-80 tasks(Operations).
Initially i was canceling the operations in main thread which obviously blocked the main thread but now i have done that in a different thread.But my main issue is that it takes too long.
Any Suggestions ?
Your operation should check to see if it’s been cancelled more often (e.g. in its implementation of
-main).Beyond that, run a sampler to see what is taking all that time.