> On Sep 12, 2016, at 03:02 , Quinn The Eskimo! via swift-users 
> <[email protected]> wrote:
> 
> 
> On 12 Sep 2016, at 09:20, Rick Mann <[email protected]> wrote:
> 
>> I've always wondered why that was the case.
> 
> Implementing `dispatch_once` so that it’s fast on all CPU architectures, 
> including those with a weak memory model, requires that ‘once token’:
> 
> * be initialised to 0 before `dispatch_once` sees it
> 
> * not modified by anything other than `dispatch_once`
> 
> That’s true for [switching to Obj-C terminology here] global variables, which 
> are initialised by the linker to 0 before any instruction in the process 
> runs, but it’s not true for ivars.
> 
> If you want to see how this really works, you can check out the source in 
> Darwin.
> 
> <http://opensource.apple.com/source/libdispatch/libdispatch-500.1.5/src/once.c>
> 
> Frankly, it hurts my brain )-:

Wheeeee!


-- 
Rick Mann
[email protected]


_______________________________________________
swift-users mailing list
[email protected]
https://lists.swift.org/mailman/listinfo/swift-users

Reply via email to