Skip to content

Commit f67304a

Browse files
notgulltaiki-e
authored andcommitted
Enable an option for portable-atomic (#2670)
1 parent 64eb689 commit f67304a

File tree

3 files changed

+11
-2
lines changed

3 files changed

+11
-2
lines changed

futures-core/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ unstable = []
2121
cfg-target-has-atomic = []
2222

2323
[dependencies]
24+
portable-atomic = { version = "0.3.15", default-features = false, optional = true }
2425

2526
[dev-dependencies]
2627
futures = { path = "../futures" }

futures-core/src/task/__internal/atomic_waker.rs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
use core::cell::UnsafeCell;
22
use core::fmt;
3-
use core::sync::atomic::AtomicUsize;
4-
use core::sync::atomic::Ordering::{AcqRel, Acquire, Release};
53
use core::task::Waker;
64

5+
use atomic::AtomicUsize;
6+
use atomic::Ordering::{AcqRel, Acquire, Release};
7+
8+
#[cfg(feature = "portable-atomic")]
9+
use portable_atomic as atomic;
10+
11+
#[cfg(not(feature = "portable-atomic"))]
12+
use core::sync::atomic;
13+
714
/// A synchronization primitive for task wakeup.
815
///
916
/// Sometimes the task interested in a given event will change over time.

futures-util/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ io-compat = ["io", "compat", "tokio-io"]
2121
sink = ["futures-sink"]
2222
io = ["std", "futures-io", "memchr"]
2323
channel = ["std", "futures-channel"]
24+
portable-atomic = ["futures-core/portable-atomic"]
2425

2526
# Unstable features
2627
# These features are outside of the normal semver guarantees and require the

0 commit comments

Comments
 (0)