Skip to content

Commit

Permalink
docs: Mention features for basic_scheduler, threaded_scheduler (#1858)
Browse files Browse the repository at this point in the history
Fixes #1829
  • Loading branch information
osa1 authored and ipetkov committed Nov 29, 2019
1 parent 4261ab6 commit ec7f2ae
Showing 1 changed file with 15 additions and 17 deletions.
32 changes: 15 additions & 17 deletions tokio/src/runtime/builder.rs
Expand Up @@ -152,23 +152,6 @@ impl Builder {
self
}

/// 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 basic_scheduler(&mut self) -> &mut Self {
self.kind = Kind::Basic;
self
}

/// Use a multi-threaded scheduler for executing tasks.
#[cfg(feature = "rt-threaded")]
pub fn threaded_scheduler(&mut self) -> &mut Self {
self.kind = Kind::ThreadPool;
self
}

/// Set name of threads spawned by the `Runtime`'s thread pool.
///
/// The default name is "tokio-runtime-worker".
Expand Down Expand Up @@ -369,6 +352,15 @@ cfg_time! {

cfg_rt_core! {
impl Builder {
/// 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.
pub fn basic_scheduler(&mut self) -> &mut Self {
self.kind = Kind::Basic;
self
}

fn build_basic_runtime(&mut self) -> io::Result<Runtime> {
use crate::runtime::{BasicScheduler, Kind};

Expand Down Expand Up @@ -407,6 +399,12 @@ cfg_rt_core! {

cfg_rt_threaded! {
impl Builder {
/// Use a multi-threaded scheduler for executing tasks.
pub fn threaded_scheduler(&mut self) -> &mut Self {
self.kind = Kind::ThreadPool;
self
}

fn build_threaded_runtime(&mut self) -> io::Result<Runtime> {
use crate::runtime::{Kind, ThreadPool};
use crate::runtime::park::Parker;
Expand Down

0 comments on commit ec7f2ae

Please sign in to comment.