summaryrefslogtreecommitdiffstats
path: root/tokio/src/executor/loom/std/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'tokio/src/executor/loom/std/mod.rs')
-rw-r--r--tokio/src/executor/loom/std/mod.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/tokio/src/executor/loom/std/mod.rs b/tokio/src/executor/loom/std/mod.rs
index 568912bf..eb865d98 100644
--- a/tokio/src/executor/loom/std/mod.rs
+++ b/tokio/src/executor/loom/std/mod.rs
@@ -1,10 +1,12 @@
+// rt-full implies rt-current-thread
+
#[cfg(feature = "rt-full")]
mod atomic_u32;
mod atomic_usize;
-#[cfg(feature = "rt-full")]
+#[cfg(feature = "rt-current-thread")]
mod causal_cell;
-#[cfg(feature = "rt-full")]
+#[cfg(feature = "rt-current-thread")]
pub(crate) mod alloc {
#[derive(Debug)]
pub(crate) struct Track<T> {
@@ -26,7 +28,7 @@ pub(crate) mod alloc {
}
}
-#[cfg(feature = "rt-full")]
+#[cfg(feature = "rt-current-thread")]
pub(crate) mod cell {
pub(crate) use super::causal_cell::{CausalCell, CausalCheck};
}
@@ -62,15 +64,23 @@ pub(crate) mod sync {
pub(crate) use crate::executor::loom::std::atomic_usize::AtomicUsize;
#[cfg(feature = "rt-full")]
- pub(crate) use std::sync::atomic::{fence, spin_loop_hint, AtomicPtr};
+ pub(crate) use std::sync::atomic::spin_loop_hint;
+ #[cfg(feature = "rt-current-thread")]
+ pub(crate) use std::sync::atomic::{fence, AtomicPtr};
}
}
-#[cfg(feature = "rt-full")]
+#[cfg(feature = "rt-current-thread")]
pub(crate) mod sys {
+ #[cfg(feature = "rt-full")]
pub(crate) fn num_cpus() -> usize {
usize::max(1, num_cpus::get_physical())
}
+
+ #[cfg(not(feature = "rt-full"))]
+ pub(crate) fn num_cpus() -> usize {
+ 1
+ }
}
#[cfg(any(feature = "blocking", feature = "rt-full"))]