Skip to content

Consider avoiding AtomicT recommendation #11

@SabrinaJewson

Description

@SabrinaJewson

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions