My app creates lots of MyOperations (subclass of NSOperation) and puts them into an NSOperationQueue. These operations do not do any I/O - they just use the Cpu.
When I make some other app active and then try again to make my app active, my app beach-balls. When all my operations have finished, the app becomes responsive again. This seems to be a known problem: <http://stackoverflow.com/questions/13148684/deadlock-using-dispatch-semaphore-t-in-a-concurrent-queue> I used to do: [ self.operationQueue setMaxConcurrentOperationCount: NSOperationQueueDefaultMaxConcurrentOperationCount ]; because I wanted "the receiver to choose an appropriate value based on the number of available processors and other relevant factors." But, the receiver obviously chooses a value, which is NOT appropriate at all. When I change this to: [ self.operationQueue setMaxConcurrentOperationCount: 7 ]; my app runs 3% slower (not 14% slower as I expected) and the beach-ball problem disappears. The problem: 7 is the right magic number on my machine with my number of processor cores etc. But certainly on other machines the number will be different. So: How do I choose an appropriate number? And is this a bug (NSOperationQueue choosing an inappropriate number) or not? Gerriet. P.S. Big thanks to Jonathan for his very valuable help off-list. _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com