#portable-atomic #synchronization-primitive #atomic

no-std portable-atomic-util

Synchronization primitives built with portable-atomic

7 releases

new 0.2.5 Jan 31, 2026
0.2.4 Nov 23, 2024
0.2.3 Oct 17, 2024
0.2.2 Jul 11, 2024
0.1.1 Mar 24, 2023

#846 in Concurrency

Download history 769760/week @ 2025-10-11 785946/week @ 2025-10-18 871262/week @ 2025-10-25 822112/week @ 2025-11-01 873228/week @ 2025-11-08 900903/week @ 2025-11-15 705353/week @ 2025-11-22 757513/week @ 2025-11-29 1007823/week @ 2025-12-06 967479/week @ 2025-12-13 492399/week @ 2025-12-20 481726/week @ 2025-12-27 966066/week @ 2026-01-03 1104139/week @ 2026-01-10 1177554/week @ 2026-01-17 1156422/week @ 2026-01-24

4,488,431 downloads per month
Used in 5,881 crates (33 directly)

Apache-2.0 OR MIT

1MB
21K SLoC

portable-atomic-util

crates.io docs.rs license msrv github actions

Synchronization primitives built with portable-atomic.

  • Provide Arc. (optional, requires the std or alloc feature)
  • Provide task::Wake. (optional, requires the std or alloc feature)

See #1 for other primitives being considered for addition to this crate.

Optional features

  • std
    Use std.

    Note:

    • This implicitly enables the alloc feature.
  • alloc
    Use alloc.

    Note:

    • The MSRV when this feature is enabled and the std feature is not enabled is Rust 1.36 that alloc crate stabilized.

Optional cfg

One of the ways to enable cfg is to set rustflags in the cargo config:

# .cargo/config.toml
[target.<target>]
rustflags = ["--cfg", "portable_atomic_unstable_coerce_unsized"]

Or set environment variable:

RUSTFLAGS="--cfg portable_atomic_unstable_coerce_unsized" cargo ...
  • --cfg portable_atomic_unstable_coerce_unsized
    Support coercing of Arc<T> to Arc<U> as in std::sync::Arc.

    This cfg requires Rust nightly because this coercing requires unstable CoerceUnsized trait.

    See this issue comment for another known workaround.

    Note: This cfg is unstable and outside of the normal semver guarantees and minor or patch versions of portable-atomic-util may make breaking changes to them at any time.

License

Licensed under either of Apache License, Version 2.0 or MIT license at your option.

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Dependencies