Skip to content

Commit f61508a

Browse files
authored
Merge pull request #265 from taiki-e/portable-atomic
Add portable-atomic feature and disable portable-atomic/critical-section by default
2 parents 72f7c2e + 449e5d7 commit f61508a

File tree

3 files changed

+12
-9
lines changed

3 files changed

+12
-9
lines changed

Cargo.lock.msrv

-3
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+10-4
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ members = ["xtask"]
2121

2222
[dependencies]
2323
parking_lot_core = { version = "0.9.10", optional = true, default-features = false }
24-
portable-atomic = { version = "1.7", optional = true }
24+
portable-atomic = { version = "1.7", optional = true, default-features = false }
2525
critical-section = { version = "1.1.3", optional = true }
2626

2727
[dev-dependencies]
@@ -38,17 +38,23 @@ std = ["alloc"]
3838
alloc = ["race"]
3939

4040
# Enables `once_cell::race` module.
41-
race = []
41+
race = ["portable-atomic?/require-cas"]
4242

4343
# Uses parking_lot to implement once_cell::sync::OnceCell.
4444
# This makes no speed difference, but makes each OnceCell<T>
4545
# up to 16 bytes smaller, depending on the size of the T.
4646
parking_lot = ["dep:parking_lot_core"]
4747

48-
# Uses `critical-section` to implement `sync` and `race` modules. in
48+
# Uses `portable-atomic` to implement `race` module. in
49+
# `#![no_std]` mode. Please read `portable-atomic` docs carefully
50+
# before enabling this feature.
51+
portable-atomic = ["dep:portable-atomic"]
52+
53+
# Uses `critical-section` to implement `sync` module. in
4954
# `#![no_std]` mode. Please read `critical-section` docs carefully
5055
# before enabling this feature.
51-
critical-section = ["dep:critical-section", "portable-atomic/critical-section"]
56+
# `portable-atomic` feature is enabled for backwards compatibility.
57+
critical-section = ["dep:critical-section", "portable-atomic"]
5258

5359
# Enables semver-exempt APIs of this crate.
5460
# At the moment, this feature is unused.

src/race.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@
1919
//! `Acquire` and `Release` have very little performance overhead on most
2020
//! architectures versus `Relaxed`.
2121
22-
#[cfg(not(feature = "critical-section"))]
22+
#[cfg(not(feature = "portable-atomic"))]
2323
use core::sync::atomic;
24-
#[cfg(feature = "critical-section")]
24+
#[cfg(feature = "portable-atomic")]
2525
use portable_atomic as atomic;
2626

2727
use atomic::{AtomicPtr, AtomicUsize, Ordering};

0 commit comments

Comments
 (0)