1

Any way to check how many blocks are running on a concurrent queue?

I want to limit running blocks in a concurrent queue, and add a new block only if this number is lower i.e. 3. Any way to do it?

The reason I read here, that maximum number of threads is 64. Above it app will freeze.

Community
  • 1
  • 1
János
  • 32,867
  • 38
  • 193
  • 353
  • The `dispatch_group_leave` is to be used together with `dispatch_group_enter`, but they are to be used when not using `dispatch_group_async`. More info here: https://developer.apple.com/library/mac/documentation/Performance/Reference/GCD_libdispatch_Ref/index.html#//apple_ref/c/func/dispatch_group_enter – pteofil May 04 '15 at 20:45
  • 2
    While you may be able to accomplish that with a dispatch semaphore, it would be much easier to use NSOperation with NSOperationQueue. NSOperationQueue is a higher level API and provides a more fine control over the execution of operations. – pteofil May 05 '15 at 12:04

0 Answers0