Skip to content

Commit c925fff

Browse files
committed
添加(注意:使用 dispatch_barrier_async ,该函数只能搭配自定义并行队列 dispatch_queue_t
使用。 )【42. `dispatch_barrier_async`的作用是什么?】
1 parent 0c1f830 commit c925fff

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

01《招聘一个靠谱的iOS》面试题参考答案/《招聘一个靠谱的iOS》面试题参考答案(下).md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -645,6 +645,9 @@ dispatch_group_notify(group, dispatch_get_main_queue(), ^{
645645
646646
打个比方:比如你们公司周末跟团旅游,高速休息站上,司机说:大家都去上厕所,速战速决,上完厕所就上高速。超大的公共厕所,大家同时去,程序猿很快就结束了,但程序媛就可能会慢一些,即使你第一个回来,司机也不会出发,司机要等待所有人都回来后,才能出发。 `dispatch_barrier_async` 函数追加的内容就如同 “上完厕所就上高速”这个动作。
647647
648+
(注意:使用 `dispatch_barrier_async` ,该函数只能搭配自定义并行队列 `dispatch_queue_t` 使用。不能使用: `dispatch_get_global_queue` ,否则 `dispatch_barrier_async` 的作用会和 `dispatch_async` 的作用一模一样。 )
649+
650+
648651
###43. 苹果为什么要废弃`dispatch_get_current_queue`?
649652
650653
`dispatch_get_current_queue`容易造成死锁

0 commit comments

Comments
 (0)