So I am reading Facebook's awesome AsyncDisplayKit source code. Specifically, I am reading the implementation behind ASDealloc2MainObject. One thing caught my eye.
In _AS-objc-internal.h, line 423 to 424, there is the programmer dispatching some task onto the main queue.
dispatch_barrier_async_f(dispatch_get_main_queue(), self, \
_objc_deallocOnMainThreadHelper); \
As is the case of other dispatch barrier functions, the barrier logic from dispatch_barrier_async_f()
only makes sense if it's dealing with a custom concurrent queue. For global concurrent queues and the main queue, it'll act just like dispatch_async_f()
with the barrier having no effect.
So why using barrier here?
That looks like a mistake to me. At best, they're trying to signal intent and remind the programmer "hey, this thing is serial", but that seems pretty dubious.