dispatch_sync:As an optimization, this function invokes the block on the current thread when possible

两件事情:

1、是否是一个线程;

2、queue task 的目标线程是否有未完成的task。

模型:一个线程处理当前的task还有通过gc d派发来的待执行task。

猜测:

如果目标thread上除了当前task,没有其它的task,派发到thread task 可以 优化为直接执行。

如果有其它待执行task,则会导致死锁。

猜你喜欢

转载自www.cnblogs.com/feng9exe/p/9175227.html