summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--tokio/src/sync/mod.rs2
-rw-r--r--tokio/src/sync/task/atomic_waker.rs13
-rw-r--r--tokio/src/sync/task/mod.rs2
-rw-r--r--tokio/src/sync/tests/atomic_waker.rs (renamed from tokio/tests/sync_atomic_waker.rs)4
-rw-r--r--tokio/src/sync/tests/mod.rs12
5 files changed, 21 insertions, 12 deletions
diff --git a/tokio/src/sync/mod.rs b/tokio/src/sync/mod.rs
index 25f58ffd..cf003816 100644
--- a/tokio/src/sync/mod.rs
+++ b/tokio/src/sync/mod.rs
@@ -47,7 +47,7 @@ pub mod oneshot;
pub mod semaphore;
mod task;
-pub use task::AtomicWaker;
+pub(crate) use task::AtomicWaker;
pub mod watch;
diff --git a/tokio/src/sync/task/atomic_waker.rs b/tokio/src/sync/task/atomic_waker.rs
index 88d083d6..eaad17c1 100644
--- a/tokio/src/sync/task/atomic_waker.rs
+++ b/tokio/src/sync/task/atomic_waker.rs
@@ -20,7 +20,7 @@ use std::task::Waker;
///
/// A single `AtomicWaker` may be reused for any number of calls to `register` or
/// `wake`.
-pub struct AtomicWaker {
+pub(crate) struct AtomicWaker {
state: AtomicUsize,
waker: CausalCell<Option<Waker>>,
}
@@ -132,7 +132,7 @@ const WAKING: usize = 0b10;
impl AtomicWaker {
/// Create an `AtomicWaker`
- pub fn new() -> AtomicWaker {
+ pub(crate) fn new() -> AtomicWaker {
AtomicWaker {
state: AtomicUsize::new(WAITING),
waker: CausalCell::new(None),
@@ -142,7 +142,8 @@ impl AtomicWaker {
/// Registers the current waker to be notified on calls to `wake`.
///
/// This is the same as calling `register_task` with `task::current()`.
- pub fn register(&self, waker: Waker) {
+ #[cfg(feature = "io-driver")]
+ pub(crate) fn register(&self, waker: Waker) {
self.do_register(waker);
}
@@ -161,7 +162,7 @@ impl AtomicWaker {
/// idea. Concurrent calls to `register` will attempt to register different
/// tasks to be woken. One of the callers will win and have its task set,
/// but there is no guarantee as to which caller will succeed.
- pub fn register_by_ref(&self, waker: &Waker) {
+ pub(crate) fn register_by_ref(&self, waker: &Waker) {
self.do_register(waker);
}
@@ -238,7 +239,7 @@ impl AtomicWaker {
/// Wakes the task that last called `register`.
///
/// If `register` has not been called yet, then this does nothing.
- pub fn wake(&self) {
+ pub(crate) fn wake(&self) {
debug!(" + wake");
if let Some(waker) = self.take_waker() {
waker.wake();
@@ -247,7 +248,7 @@ impl AtomicWaker {
/// Attempts to take the `Waker` value out of the `AtomicWaker` with the
/// intention that the caller will wake the task later.
- pub fn take_waker(&self) -> Option<Waker> {
+ pub(crate) fn take_waker(&self) -> Option<Waker> {
debug!(" + take_waker");
// AcqRel ordering is used in order to acquire the value of the `waker`
// cell as well as to establish a `release` ordering with whatever
diff --git a/tokio/src/sync/task/mod.rs b/tokio/src/sync/task/mod.rs
index 446ff712..a6bc6ed0 100644
--- a/tokio/src/sync/task/mod.rs
+++ b/tokio/src/sync/task/mod.rs
@@ -1,4 +1,4 @@
//! Thread-safe task notification primitives.
mod atomic_waker;
-pub use self::atomic_waker::AtomicWaker;
+pub(crate) use self::atomic_waker::AtomicWaker;
diff --git a/tokio/tests/sync_atomic_waker.rs b/tokio/src/sync/tests/atomic_waker.rs
index 8e725526..c832d62e 100644
--- a/tokio/tests/sync_atomic_waker.rs
+++ b/tokio/src/sync/tests/atomic_waker.rs
@@ -1,6 +1,4 @@
-#![warn(rust_2018_idioms)]
-
-use tokio::sync::AtomicWaker;
+use crate::sync::AtomicWaker;
use tokio_test::task;
use std::task::Waker;
diff --git a/tokio/src/sync/tests/mod.rs b/tokio/src/sync/tests/mod.rs
index 8e627cb8..8da739f9 100644
--- a/tokio/src/sync/tests/mod.rs
+++ b/tokio/src/sync/tests/mod.rs
@@ -1,7 +1,17 @@
-#![cfg(loom)]
+#[cfg(not(loom))]
+mod atomic_waker;
+#[cfg(loom)]
mod loom_atomic_waker;
+
+#[cfg(loom)]
mod loom_list;
+
+#[cfg(loom)]
mod loom_mpsc;
+
+#[cfg(loom)]
mod loom_oneshot;
+
+#[cfg(loom)]
mod loom_semaphore;