I would like to make a queue wait for a short period while it is looping. I am considering my options and was testing out suspending a resuming a queue but that seems to require several moving parts. So I am considering using sleep or usleep instead. That is more of a general threading function and would like to know if I should avoid using sleep and instead stick with GCD options to make a queue pause.
I found one related question but that answer shows that he was just missing an include. Are there any concerns with mixing sleep calls in with GCD queues?
iphone – is it ok to use usleep on a secondary thread on Grand Central Dispatch?
You can use sleep, but as you mentioned, do it off of the main thread, as you should never tie up the main thread.
But, if you need a small sleep, the amount of time may not be precise, and is unlikely to be, but the thread will be woken up at least after the amount of sleep, depending on what else may be using the cpu.
But, I see no problem with using sleep as it will at least give other threads/applications, a chance to run.