What's the difference between the “global queue” and the “main queue” in GCD?

前端 未结 4 761
感动是毒
感动是毒 2020-12-12 14:22

Among some other ways, there are these two ways to get queues in GCD:

dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);

dispatch_g         


        
4条回答
  •  忘掉有多难
    2020-12-12 15:05

    The 5 queues (4 background, 1 main) all have different thread priorities (-[NSThread threadPriority]) too:

                                -main- : 0.758065
          DISPATCH_QUEUE_PRIORITY_HIGH : 0.532258
       DISPATCH_QUEUE_PRIORITY_DEFAULT : 0.500000
           DISPATCH_QUEUE_PRIORITY_LOW : 0.467742
    DISPATCH_QUEUE_PRIORITY_BACKGROUND : 0.000000
    

    (tested on an iPod 4th gen and the simulator on a MacBook Pro)

提交回复
热议问题