Dispatch_barrier_async and ordinal queue in GCD, what are the differences between them?

I found that the working mechanism of dispatch_barrier_async is that it only executes after all blocks previously added to the queue are complete. It works like a sequential queue.

Therefore, I do not distinguish between the differences between the two modes of operation in GCD.

enter image description here

+6
source share
2 answers

dispatch_barrier_[a]syncDesigned for use with a parallel queue. They are also intended for use with calls dispatch_[a]sync.

"multi-reader, one writer". . "" dispatch_[a]sync. "writer" dispatch_barrier_[a]sync.

, .

, - .

+22

, . , ( 0 3 ), ( " " 4 ), ( 5 6 ).

, , , . , " ".

, :

comparison

, , , , . , , , , , . , , . , .

, 10 , 11- . , 10 , , 10 ( " ").

, rmaddy (+1), - - , ( ), ( ). dispatch_sync dispatch_barrier_async .

+10

Source: https://habr.com/ru/post/1656430/


All Articles