[iOS] Setting maxConcurrentOperationCount for NSOperation to Limit Concurrent Threads

Tadashi Shigeoka ·  Fri, May 3, 2013

To limit the concurrent threads of NSOperation, you can set maxConcurrentOperationCount.

For example, if you want to execute a maximum of 2 threads in addition to the main thread, set it as follows:

sharedQueue = [[NSOperationQueue alloc] init];
sharedQueue.maxConcurrentOperationCount = 2;

That’s all from the Gemba.