DispatchQueue depth

Hi,

How can I get a current depth of a DispatchQueue? I cannot find any information about it.

Unsure what you mean exactly, but:

  • There is no set maximum capacity to the queue, other than running out of memory.
  • You can't probe the queue to see how many blocks are currently enqueued.

As said, DispatchQueue has no such api. You'll probably need to implement them yourself like custom counter, semaphore if you have a hard upper bound, or even Little's law (when long term statistics is similar to short term one) if you're feeling fancy.

Thanks to all, that's exactly what I wanted to know.

Terms of Service

Privacy Policy

Cookie Policy