[swift-users] Lazy expression is ambiguous?
Rick Mann
rmann at latencyzero.com
Mon Sep 12 05:14:51 CDT 2016
> On Sep 12, 2016, at 03:02 , Quinn The Eskimo! via swift-users <swift-users at swift.org> wrote:
>
>
> On 12 Sep 2016, at 09:20, Rick Mann <rmann at latencyzero.com> 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
rmann at latencyzero.com
More information about the swift-users
mailing list