about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJames Munns <james.munns@ferrous-systems.com>2020-11-17 01:38:53 +0100
committerGitHub <noreply@github.com>2020-11-17 01:38:53 +0100
commit69477f50d86e1e28332ddaa1adb25846087e89ec (patch)
tree55caaee3ed6411055a86c026160c867fcc0d9166
parentf5230fbf76bafd86ee4376a0e26e551df8d17fec (diff)
downloadrust-69477f50d86e1e28332ddaa1adb25846087e89ec.tar.gz
rust-69477f50d86e1e28332ddaa1adb25846087e89ec.zip
Clarify availability of atomic operations
This was noticed while we were updating the embedded rust book: https://github.com/rust-embedded/book/pull/273/files

These targets do natively have atomic load/stores, but do not support CAS operations.
-rw-r--r--library/core/src/sync/atomic.rs13
1 files changed, 10 insertions, 3 deletions
diff --git a/library/core/src/sync/atomic.rs b/library/core/src/sync/atomic.rs
index d48c02bf59c..9d204599057 100644
--- a/library/core/src/sync/atomic.rs
+++ b/library/core/src/sync/atomic.rs
@@ -47,9 +47,16 @@
 //!
 //! * PowerPC and MIPS platforms with 32-bit pointers do not have `AtomicU64` or
 //!   `AtomicI64` types.
-//! * ARM platforms like `armv5te` that aren't for Linux do not have any atomics
-//!   at all.
-//! * ARM targets with `thumbv6m` do not have atomic operations at all.
+//! * ARM platforms like `armv5te` that aren't for Linux only provide `load`
+//!   and `store` operations, and do not support Compare and Swap (CAS)
+//!   operations, such as `swap`, `fetch_add`, etc. Additionally on Linux,
+//!   these CAS operations are implemented via [operating system support], which
+//!   may come with a performance penalty.
+//! * ARM targets with `thumbv6m` only provide `load` and `store` operations,
+//!   and do not support Compare and Swap (CAS) operations, such as `swap`,
+//!   `fetch_add`, etc.
+//!
+//! [operating system support]: https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt
 //!
 //! Note that future platforms may be added that also do not have support for
 //! some atomic operations. Maximally portable code will want to be careful