Create a high priority serial dispatch queue with GCD

前端 未结 3 1004
情书的邮戳
情书的邮戳 2020-12-09 09:44

How can I create a custom serial queue that runs at high priority?

Right now I\'m using myQueue = dispatch_queue_create(\"com.MyApp.MyQueue\", NULL); bu

3条回答
  •  春和景丽
    2020-12-09 09:47

    is it a requirement that you have a custom queue? If not, you could look at dispatching a block to the high priority global queue, which you can retrieve using:

    dispatch_queue_t q = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0)
    

    keep in mind that this is the global queue so it may impact other concurrent operations.

提交回复
热议问题