diff options
Diffstat (limited to 'tokio/src/runtime/builder.rs')
-rw-r--r-- | tokio/src/runtime/builder.rs | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/tokio/src/runtime/builder.rs b/tokio/src/runtime/builder.rs index 66c9e166..72cbc9c4 100644 --- a/tokio/src/runtime/builder.rs +++ b/tokio/src/runtime/builder.rs @@ -61,7 +61,7 @@ pub struct Builder { enum Kind { Shell, #[cfg(feature = "rt-core")] - CurrentThread, + Basic, #[cfg(feature = "rt-full")] ThreadPool, } @@ -121,19 +121,19 @@ impl Builder { self } - /// Use only the current thread for executing tasks. + /// Use a simpler scheduler that runs all tasks on the current-thread. /// /// The executor and all necessary drivers will all be run on the current /// thread during `block_on` calls. #[cfg(feature = "rt-core")] - pub fn current_thread(&mut self) -> &mut Self { - self.kind = Kind::CurrentThread; + pub fn basic_scheduler(&mut self) -> &mut Self { + self.kind = Kind::Basic; self } - /// Use a thread-pool for executing tasks. + /// Use a multi-threaded scheduler for executing tasks. #[cfg(feature = "rt-full")] - pub fn thread_pool(&mut self) -> &mut Self { + pub fn threaded_scheduler(&mut self) -> &mut Self { self.kind = Kind::ThreadPool; self } @@ -252,15 +252,15 @@ impl Builder { /// ``` pub fn build(&mut self) -> io::Result<Runtime> { match self.kind { - Kind::Shell => self.build_shell(), + Kind::Shell => self.build_shell_runtime(), #[cfg(feature = "rt-core")] - Kind::CurrentThread => self.build_current_thread(), + Kind::Basic => self.build_basic_runtime(), #[cfg(feature = "rt-full")] - Kind::ThreadPool => self.build_threadpool(), + Kind::ThreadPool => self.build_threaded_runtime(), } } - fn build_shell(&mut self) -> io::Result<Runtime> { + fn build_shell_runtime(&mut self) -> io::Result<Runtime> { use crate::runtime::Kind; let clock = time::create_clock(); @@ -289,8 +289,8 @@ impl Builder { } #[cfg(feature = "rt-core")] - fn build_current_thread(&mut self) -> io::Result<Runtime> { - use crate::runtime::{CurrentThread, Kind}; + fn build_basic_runtime(&mut self) -> io::Result<Runtime> { + use crate::runtime::{BasicScheduler, Kind}; let clock = time::create_clock(); @@ -305,7 +305,7 @@ impl Builder { // there are no futures ready to do something, it'll let the timer or // the reactor to generate some new stimuli for the futures to continue // in their life. - let scheduler = CurrentThread::new(driver); + let scheduler = BasicScheduler::new(driver); let spawner = scheduler.spawner(); // Blocking pool @@ -313,9 +313,9 @@ impl Builder { let blocking_spawner = blocking_pool.spawner().clone(); Ok(Runtime { - kind: Kind::CurrentThread(scheduler), + kind: Kind::Basic(scheduler), handle: Handle { - kind: handle::Kind::CurrentThread(spawner), + kind: handle::Kind::Basic(spawner), io_handles, time_handles, clock, @@ -326,7 +326,7 @@ impl Builder { } #[cfg(feature = "rt-full")] - fn build_threadpool(&mut self) -> io::Result<Runtime> { + fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::runtime::{Kind, ThreadPool}; use std::sync::Mutex; |