Skip to content

Commit 6840438

Browse files
committed
[SE-0282] Update status; apply the core team’s acceptance notes
# Conflicts: # proposals/0282-atomics.md
1 parent 1743439 commit 6840438

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

proposals/0282-atomics.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
# Interoperability with the C Atomic Operations Library ⚛︎
1+
# Clarify the Swift memory consistency model ⚛︎
22

33
* Proposal: [SE-0282](0282-atomics.md)
44
* Author: [Karoy Lorentey](https://github.com/lorentey)
55
* Review Manager: [Joe Groff](https://github.com/jckarter)
66
* Bug: [SR-9144](https://bugs.swift.org/browse/SR-9144)
77
* Implementation: Proof of concept [swift-atomics package][package]
88
* Previous Revision: [v1][SE-0282v1] ([Returned for revision](https://forums.swift.org/t/se-0282-low-level-atomic-operations/35382/69))
9-
* Status: **Active review (June 8...June 25, 2020)**
9+
* Status: **Implemented (Swift 5.3)**
10+
* Decision Notes: [Rationale](https://forums.swift.org/t/accepted-se-0282-interoperability-with-the-c-atomic-operations-library/38050)
1011

1112
[SE-0282v1]: https://github.com/apple/swift-evolution/blob/3a358a07e878a58bec256639d2beb48461fc3177/proposals/0282-atomics.md
1213
[package]: https://github.com/apple/swift-se-0282-experimental
@@ -65,6 +66,9 @@ When applied carefully, atomic operations and memory ordering constraints can be
6566

6667
For now, we will be heavily relying on the Law of Exclusivity as defined in [[SE-0176]] and the [[Ownership Manifesto]], and we'll explain to what extent C's memory orderings apply to Swift's variable accesses. The intention is that Swift's memory model will be fully interoperable with its C/C++ counterparts.
6768

69+
This proposal does not specify whether/how dependency chains arising from the C/C++ `memory_order_consume` memory ordering work in Swift. The consume ordering as specified in the C/C++ standards is not implemented in any C/C++ compiler, and we join the current version of the C++ standard in encouraging Swift programmers not to use it. We expect to tackle the problem of efficient traversal of concurrent data structures in future proposals. Meanwhile, Swift programmers can start building useful concurrency constructs using relaxed, acquire/release, and sequentially consistent memory orderings imported from C.
70+
71+
6872
### Amendment to The Law of Exclusivity
6973

7074
While the declarations in C's `stdatomic.h` header don't directly import into Swift, it is still possible to access these constructs from Swift code by [wrapping them into plain structs and functions][package] that can be imported. This way, `_Atomic` values can end up being stored within a Swift variable.

0 commit comments

Comments
 (0)