I had assumed that dispatch_once() was implemented as a basic atomic compare-and-swap, but the source for dispatch_once_f contains an interesting comment: Normally, a barrier on the read side is used to workaround the weakly ordered memory model. But barriers are expensive and we only need to synchronize once! After func(ctxt) completes, the predicate will be … Continue reading Making dispatch_once() Fast
Copy and paste this URL into your WordPress site to embed
Copy and paste this code into your site to embed