News for hackers. Stuff that matters.
Re:Secrets of dispatch_once; x86 performance trickery by quotemstr on Friday June 06, 2014 @10:04PM (#7861037)
You'd allocate a trampoline for each predicate, jump unconditionally into that, then jump unconditionally back to mainline code. Each trampoline can be modifier individually. Of course that doesn't work with the current dispatch_once API, though.
Re:Secrets of dispatch_once; x86 performance trickery by mikeash on Friday June 06, 2014 @10:16PM (#7861058)
Doesn't this have all the same problems as the way they currently do it? The only difference between the two is that Apple's implementation puts the flag in a variable, while you're basically proposing to put the flag in code. You still need to ensure proper ordering on both reads and writes and ensure that speculative execution doesn't end up giving you the wrong answer.