-
Notifications
You must be signed in to change notification settings - Fork 84
Description
See this discussion for context: rust-lang/rust-clippy#4295
Basically, AtomicT is not just “a fast Mutex<T>”, it has many additional properties such as it not supporting locking and it accepting Ordering parameters. It is often harmful to recommend AtomicT as a direct replacement for Mutex<T>, because people can easily make assumptions about how they behave that turn out to not be correct, since their actual behaviour is quite subtle (even just with SeqCst, the model of a Mutex<T> is far simpler as it allows arbitrary mutation while in the “locked” state). I see AtomicT as beïng a very low-level primitive for implementing concurrent data structures; it’s mostly too complex for high-level code. Generally, if someone understands Rust well enough to correctly know how to use atomics, they would not need this chart in the first place.