Why dispatch_sync( ) call on main queue is blocking the main queue?

前端 未结 5 2106
花落未央
花落未央 2020-12-19 11:17

I know this is not a strong question but I have to clear my mind on this concept.

I have defined myBlock as follows.

void(^myBlock)(v         


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-19 12:24

    When using dispatch_sync on a serial queue (like the main queue) the current thread has to wait until the dispatched code is executed.

    A dead lock occurs when a block is dispatched synchronously on from a serial queue to the same queue.

提交回复
热议问题