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.

posted @ 2017-12-12 21:17  洒水先生  阅读(238)  评论(0编辑  收藏  举报