[swift-evolution] [pitch] Atomics

Guillaume Lessard glessard at tffenterprises.com
Thu Feb 23 15:44:48 CST 2017


There is no clean way to use atomic operations in Swift at the moment, even less so after most of OSAtomic.h was deprecated in Sierra. Of course, the OSAtomic calls were never available in Linux, so there are no atomics at all on that side. It's technically possible to wrap clang’s C11 atomics for use in Swift; such a wrapper can be made cross-platform, but still isn't a particularly great solution.

It looks to me as if this would pretty much be a library addition, since atomics support seems to be fairly complete in the Builtin module. Would a proposal be welcome?

I sketched an atomic Int64 in the following branch:
https://github.com/glessard/swift/tree/atomics-sketch

Cheers,
Guillaume Lessard



More information about the swift-evolution mailing list