Skip to content

Commit

Permalink
Move AtomicWaker to futures-core
Browse files Browse the repository at this point in the history
... so `AtomicWaker` could be used inside `futures-channel`.

`AtomicWaker` is still accessible to users only from `futures-util`.
  • Loading branch information
stepancheg authored and cramertj committed Nov 10, 2018
1 parent cbcf1fe commit d7fffb0
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 8 deletions.
6 changes: 6 additions & 0 deletions futures-core/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
cargo-features = ["rename-dependency"]

[package]
name = "futures-core-preview"
edition = "2018"
Expand All @@ -17,6 +19,10 @@ name = "futures_core"
[features]
default = ["std"]
std = ["either/use_std"]
nightly = []

[dependencies]
either = { version = "1.4", default-features = false, optional = true }

[dev-dependencies]
futures-preview = { path = "../futures", version = "0.3.0-alpha.9" }
1 change: 1 addition & 0 deletions futures-core/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! Core traits and types for asynchronous operations in Rust.
#![feature(pin, arbitrary_self_types, futures_api)]
#![cfg_attr(feature = "nightly", feature(cfg_target_has_atomic))]

#![cfg_attr(not(feature = "std"), no_std)]

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use core::fmt;
use core::cell::UnsafeCell;
use core::sync::atomic::AtomicUsize;
use core::sync::atomic::Ordering::{Acquire, Release, AcqRel};
use futures_core::task::{LocalWaker, Waker};
use crate::task::{LocalWaker, Waker};

/// A synchronization primitive for task wakeup.
///
Expand Down
10 changes: 10 additions & 0 deletions futures-core/src/task/__internal/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#[cfg_attr(
feature = "nightly",
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
)]
mod atomic_waker;
#[cfg_attr(
feature = "nightly",
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
)]
pub use self::atomic_waker::AtomicWaker;
2 changes: 2 additions & 0 deletions futures-core/src/task/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
//! Task notification.
mod spawn;
#[doc(hidden)]
pub mod __internal;
pub use self::spawn::{Spawn, LocalSpawn, SpawnError};

pub use core::task::{Poll, Waker, LocalWaker, UnsafeWake};
Expand Down
7 changes: 1 addition & 6 deletions futures-util/src/task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,4 @@ pub use self::local_waker_ref::{local_waker_ref, local_waker_ref_from_nonlocal,
feature = "nightly",
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
)]
mod atomic_waker;
#[cfg_attr(
feature = "nightly",
cfg(all(target_has_atomic = "cas", target_has_atomic = "ptr"))
)]
pub use self::atomic_waker::AtomicWaker;
pub use futures_core::task::__internal::AtomicWaker;
2 changes: 1 addition & 1 deletion futures/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ futures-test-preview = { path = "../futures-test", version = "0.3.0-alpha.9", de
tokio = "0.1.11"

[features]
nightly = ["futures-util-preview/nightly"]
nightly = ["futures-util-preview/nightly", "futures-core-preview/nightly"]
std = ["futures-core-preview/std", "futures-executor-preview/std", "futures-io-preview/std", "futures-sink-preview/std", "futures-util-preview/std"]
default = ["std"]
compat = ["std", "futures-util-preview/compat"]
Expand Down

0 comments on commit d7fffb0

Please sign in to comment.