Is there any reason to not use sleep in a Grand Central Dispatch queue?

前端 未结 3 2009
北恋
北恋 2021-02-19 11:35

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

3条回答
  •  一个人的身影
    2021-02-19 12:32

    Using sleep with Grand Central Dispatch may be a bit of an issue because, GCD pools threads and so you are holding up a thread from being used by another job. GCD can of cause create more threads, but personnel I would avoid sleep in this situation, it would depend on the situation.

提交回复
热议问题