dispatch_sync 与 dispatch_barrier_sync 区别

最后更新:2017-12-12

dispatch_sync 与 dispatch_barrier_sync

https://github.com/rs/SDWebImage/pull/818

The reason why we are doing dispatch_barrier_sync and dispatch_sync is to synchronise the access to the NSMutableDictionary that is not thread-safe, according to the Threading Programming Guide. Same doc states that NSMapTable is not thread-safe, so I don't think your code is protected against crashes.

原文地址:https://www.cnblogs.com/gaox97329498/p/12070278.html