[swift-evolution] [pitch] Atomics

Guillaume Lessard glessard at tffenterprises.com
Fri Feb 24 16:01:32 CST 2017


> On Feb 24, 2017, at 2:11 PM, Joe Groff <jgroff at apple.com> wrote:
> 
> The only way you can make atomics sort-of-work in Swift today is by performing atomic operations on manually-allocated memory, since Swift doesn't provide the necessary control over any memory the language manages to get the guarantees you need. When we get the ownership model, you could then model atomics as *shared* borrowed values (as opposed to the *exclusive* borrowing required by `inout` today); 

I went with ‘mutating’ there because it’s the only way to make any of it compile at the moment, but I do agree that it makes limited sense as is; I presume that is why `_stdlib_AtomicInt` is a class, then.

Cheers,
Guillaume Lessard



More information about the swift-evolution mailing list