[swift-users] Simultaneous access to global tuple members
Guillaume Lessard
glessard at tffenterprises.com
Tue Aug 8 09:50:00 CDT 2017
> On Aug 8, 2017, at 01:11, Martin R via swift-users <swift-users at swift.org> wrote:
>
> SE-0176 Enforce Exclusive Access to Memory (https://github.com/apple/swift-evolution/blob/master/proposals/0176-enforce-exclusive-access-to-memory.md) states that "Accesses to different stored properties of a struct or different elements of a tuple are allowed to overlap."
>
> [snip]
>
> Is there anything special with simultaneous access to members of a global tuple, or is this a bug?
Not a bug. The very next sentence after the one you quoted: “However, note that modifying part of a value type still requires exclusive access to the entire value”. The first example in that section (https://github.com/apple/swift-evolution/blob/master/proposals/0176-enforce-exclusive-access-to-memory.md#value-types) is similar to your example; it trips the dynamic enforcement mechanism for the same reason. The second example shows a possible workaround.
Sincerely,
Guillaume Lessard
More information about the swift-users
mailing list