Skip to content

Commit

Permalink
Enable an option for portable-atomic (#2670)
Browse files Browse the repository at this point in the history
  • Loading branch information
notgull committed Dec 7, 2022
1 parent 1436c05 commit 2acba12
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions futures-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ std = ["alloc"]
alloc = []

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

[dev-dependencies]
futures = { path = "../futures" }
Expand Down
11 changes: 9 additions & 2 deletions futures-core/src/task/__internal/atomic_waker.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
use core::cell::UnsafeCell;
use core::fmt;
use core::sync::atomic::AtomicUsize;
use core::sync::atomic::Ordering::{AcqRel, Acquire, Release};
use core::task::Waker;

use atomic::AtomicUsize;
use atomic::Ordering::{AcqRel, Acquire, Release};

#[cfg(feature = "portable-atomic")]
use portable_atomic as atomic;

#[cfg(not(feature = "portable-atomic"))]
use core::sync::atomic;

/// A synchronization primitive for task wakeup.
///
/// Sometimes the task interested in a given event will change over time.
Expand Down
1 change: 1 addition & 0 deletions futures-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ io-compat = ["io", "compat", "tokio-io"]
sink = ["futures-sink"]
io = ["std", "futures-io", "memchr"]
channel = ["std", "futures-channel"]
portable-atomic = ["futures-core/portable-atomic"]

# Unstable features
# These features are outside of the normal semver guarantees and require the
Expand Down

0 comments on commit 2acba12

Please sign in to comment.