I know that i can execute tasks asynchronously with dispatch_async and dispatch_get_global_queue.
But how many threads dispatch_async create? What should i do to execute exactly N (no more, no less) threads with GCD, and performe some tasks on them? After execution of task i need to add new task in released thread, maybe in complitation block of previous task.
Or maybe i can control the count of threds with NSOperationQueue?
I know that it has property maxConcurrentOperationCount, but it control only maximum limit of tasks. So, Can I be sure that NSOperationQueue creates no less than 8 threads, in case when i set maxConcurrentOperationCount = 8 and add 12 operations to the NSOperationQueue?
Thank you very much!
maxConcurrentOperationCountis just a maximum. It could create fewer. If you need precise control over the number of threads, then you'll have to manage them yourself. - ipmcc