diff options
author | Carl Lerche <me@carllerche.com> | 2019-11-16 07:19:45 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-16 07:19:45 -0800 |
commit | 3f0eabe7798de624f5ee9c7562803bfb97e6088f (patch) | |
tree | 6458345730f7eae674ec1e7ea82f120a5f1b70bc /tokio/src/runtime/mod.rs | |
parent | 1474794055e291c544c3c95d6381d549cefbd7d5 (diff) |
runtime: rename current_thread -> basic_scheduler (#1769)
It no longer supports executing !Send futures. The use case for
It is wanting a “light” runtime. There will be “local” task execution
using a different strategy coming later.
This patch also renames `thread_pool` -> `threaded_scheduler`, but
only in public APIs for now.
Diffstat (limited to 'tokio/src/runtime/mod.rs')
-rw-r--r-- | tokio/src/runtime/mod.rs | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/tokio/src/runtime/mod.rs b/tokio/src/runtime/mod.rs index 2d595242..b2a5ba50 100644 --- a/tokio/src/runtime/mod.rs +++ b/tokio/src/runtime/mod.rs @@ -132,17 +132,17 @@ #[macro_use] mod tests; +#[cfg(feature = "rt-core")] +mod basic_scheduler; +#[cfg(feature = "rt-core")] +use self::basic_scheduler::BasicScheduler; + mod blocking; use blocking::BlockingPool; mod builder; pub use self::builder::Builder; -#[cfg(feature = "rt-core")] -mod current_thread; -#[cfg(feature = "rt-core")] -use self::current_thread::CurrentThread; - pub(crate) mod enter; use self::enter::enter; @@ -220,7 +220,7 @@ enum Kind { /// Execute all tasks on the current-thread. #[cfg(feature = "rt-core")] - CurrentThread(CurrentThread<time::Driver>), + Basic(BasicScheduler<time::Driver>), /// Execute tasks across multiple threads. #[cfg(feature = "rt-full")] @@ -255,10 +255,10 @@ impl Runtime { /// [mod]: index.html pub fn new() -> io::Result<Self> { #[cfg(feature = "rt-full")] - let ret = Builder::new().thread_pool().build(); + let ret = Builder::new().threaded_scheduler().build(); #[cfg(all(not(feature = "rt-full"), feature = "rt-core"))] - let ret = Builder::new().current_thread().build(); + let ret = Builder::new().basic_scheduler().build(); #[cfg(not(feature = "rt-core"))] let ret = Builder::new().build(); @@ -306,7 +306,7 @@ impl Runtime { Kind::Shell(_) => panic!("task execution disabled"), #[cfg(feature = "rt-full")] Kind::ThreadPool(exec) => exec.spawn(future), - Kind::CurrentThread(exec) => exec.spawn(future), + Kind::Basic(exec) => exec.spawn(future), } } @@ -329,7 +329,7 @@ impl Runtime { self.handle.enter(|| match kind { Kind::Shell(exec) => exec.block_on(future), #[cfg(feature = "rt-core")] - Kind::CurrentThread(exec) => exec.block_on(future), + Kind::Basic(exec) => exec.block_on(future), #[cfg(feature = "rt-full")] Kind::ThreadPool(exec) => exec.block_on(future), }) |