mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-21 00:00:10 +02:00
Simplify Tokio's runtime construct by combining both Runtime variants into a single type. The execution style can be controlled by a configuration setting on `Builder`. The implication of this change is that there is no longer any way to spawn `!Send` futures. This, however, is a temporary limitation. A different strategy will be employed for supporting `!Send` futures. Included in this patch is a rework of `task::JoinHandle` to support using this type from both the thread-pool and current-thread executors.
30 lines
665 B
Rust
30 lines
665 B
Rust
//! Stub out the necessary APIs to model with loom.
|
|
|
|
#[cfg(not(all(test, loom)))]
|
|
pub(crate) mod std;
|
|
|
|
#[cfg(all(test, loom))]
|
|
pub(crate) mod std {
|
|
pub(crate) use loom::{alloc, cell, sync, thread};
|
|
|
|
pub(crate) mod rand {
|
|
pub(crate) fn seed() -> u64 {
|
|
1
|
|
}
|
|
}
|
|
|
|
pub(crate) mod sys {
|
|
pub(crate) fn num_cpus() -> usize {
|
|
2
|
|
}
|
|
}
|
|
}
|
|
|
|
#[cfg(feature = "rt-full")]
|
|
pub(crate) use self::std::rand;
|
|
pub(crate) use self::std::sync;
|
|
#[cfg(any(feature = "blocking", feature = "rt-full"))]
|
|
pub(crate) use self::std::thread;
|
|
#[cfg(feature = "rt-current-thread")]
|
|
pub(crate) use self::std::{alloc, cell, sys};
|