Skip to content

Commit 69477f5

Browse files
author
James Munns
authored
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.
1 parent f5230fb commit 69477f5

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

library/core/src/sync/atomic.rs

+10-3
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,16 @@
4747
//!
4848
//! * PowerPC and MIPS platforms with 32-bit pointers do not have `AtomicU64` or
4949
//! `AtomicI64` types.
50-
//! * ARM platforms like `armv5te` that aren't for Linux do not have any atomics
51-
//! at all.
52-
//! * ARM targets with `thumbv6m` do not have atomic operations at all.
50+
//! * ARM platforms like `armv5te` that aren't for Linux only provide `load`
51+
//! and `store` operations, and do not support Compare and Swap (CAS)
52+
//! operations, such as `swap`, `fetch_add`, etc. Additionally on Linux,
53+
//! these CAS operations are implemented via [operating system support], which
54+
//! may come with a performance penalty.
55+
//! * ARM targets with `thumbv6m` only provide `load` and `store` operations,
56+
//! and do not support Compare and Swap (CAS) operations, such as `swap`,
57+
//! `fetch_add`, etc.
58+
//!
59+
//! [operating system support]: https://www.kernel.org/doc/Documentation/arm/kernel_user_helpers.txt
5360
//!
5461
//! Note that future platforms may be added that also do not have support for
5562
//! some atomic operations. Maximally portable code will want to be careful

0 commit comments

Comments
 (0)