id
stringlengths
22
133
text
stringlengths
40
40.2k
arch
stringclasses
1 value
syntax
stringclasses
1 value
kind
stringclasses
4 values
repo
stringclasses
27 values
path
stringlengths
5
116
license
stringclasses
6 values
commit
stringlengths
40
40
source_host
stringclasses
1 value
category
stringclasses
16 values
source_url
stringlengths
85
196
line_start
int64
1
4.28k
line_end
int64
4
4.31k
tokio-rs/tokio:tokio/src/runtime/builder.rs:36
/// the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_io() /// .build() /// .unwrap(); /// ``` pub fn enable_io(&mut self) -> &m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
da745ff335dea94378f5ba2b79e2c9f97cb217aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/builder.rs
1,401
1,460
tokio-rs/tokio:tokio/src/runtime/builder.rs:37
/// Enables the time driver. /// /// Doing this enables using `tokio::time` on the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_time() /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
da745ff335dea94378f5ba2b79e2c9f97cb217aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/builder.rs
1,441
1,500
tokio-rs/tokio:tokio/src/runtime/builder.rs:38
self.start_paused = start_paused; self } } } cfg_rt_multi_thread! { impl Builder { fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{Config, runtime::Scheduler}; use crate::runtime::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
da745ff335dea94378f5ba2b79e2c9f97cb217aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/builder.rs
1,481
1,540
tokio-rs/tokio:tokio/src/runtime/builder.rs:39
#[cfg(tokio_unstable)] unhandled_panic: self.unhandled_panic.clone(), disable_lifo_slot: self.disable_lifo_slot, seed_generator: seed_generator_1, metrics_poll_count_histogram: self.metrics_poll_count_histogram_builder(), },...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
da745ff335dea94378f5ba2b79e2c9f97cb217aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/builder.rs
1,521
1,580
tokio-rs/tokio:tokio/src/runtime/builder.rs:40
seed_generator_2, Config { before_park: self.before_park.clone(), after_unpark: self.after_unpark.clone(), before_spawn: self.before_spawn.clone(), after_termination: self.after_termination.clone(), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
da745ff335dea94378f5ba2b79e2c9f97cb217aa
github
async-runtime
https://github.com/tokio-rs/tokio/blob/da745ff335dea94378f5ba2b79e2c9f97cb217aa/tokio/src/runtime/builder.rs
1,561
1,600
tokio-rs/tokio:tokio/src/runtime/builder.rs:1
#![cfg_attr(loom, allow(unused_imports))] use crate::runtime::handle::Handle; use crate::runtime::{blocking, driver, Callback, HistogramBuilder, Runtime, TaskCallback}; #[cfg(tokio_unstable)] use crate::runtime::{LocalOptions, LocalRuntime, TaskMeta}; use crate::util::rand::{RngSeed, RngSeedGenerator}; use crate::run...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
512e9decfb683d22f4a145459142542caa0894c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/runtime/builder.rs
1
60
tokio-rs/tokio:tokio/src/runtime/builder.rs:30
/// using a log scale, each bucket will cover a range twice as big as /// the previous bucket. In the log case, the resolution represents the /// smallest bucket range. /// /// Note that, when using log scale, the resolution is rounded up to the /// nearest power of 2 in nanoseco...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
512e9decfb683d22f4a145459142542caa0894c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/runtime/builder.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/builder.rs:31
/// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_metrics_poll_count_histogram() /// .metrics_poll_count_histogram_buckets(15) /// .build() /// .unwrap()...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
512e9decfb683d22f4a145459142542caa0894c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/runtime/builder.rs
1,201
1,260
tokio-rs/tokio:tokio/src/runtime/builder.rs:32
fn build_current_thread_local_runtime(&mut self) -> io::Result<LocalRuntime> { use crate::runtime::local_runtime::LocalRuntimeScheduler; let tid = std::thread::current().id(); let (scheduler, handle, blocking_pool) = self.build_current_thread_runtime_components(Some(tid))?; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
512e9decfb683d22f4a145459142542caa0894c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/runtime/builder.rs
1,241
1,300
tokio-rs/tokio:tokio/src/runtime/builder.rs:33
seed_generator_2, Config { before_park: self.before_park.clone(), after_unpark: self.after_unpark.clone(), before_spawn: self.before_spawn.clone(), after_termination: self.after_termination.clone(), global_queue_interval: self.g...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
512e9decfb683d22f4a145459142542caa0894c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/runtime/builder.rs
1,281
1,340
tokio-rs/tokio:tokio/src/runtime/builder.rs:35
/// /// Doing this enables using `tokio::time` on the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_time() /// .build() /// .unwrap(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
512e9decfb683d22f4a145459142542caa0894c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/runtime/builder.rs
1,361
1,420
tokio-rs/tokio:tokio/src/runtime/builder.rs:36
self } } } cfg_rt_multi_thread! { impl Builder { fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{Config, runtime::Scheduler}; use crate::runtime::scheduler::{self, MultiThread}; l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
512e9decfb683d22f4a145459142542caa0894c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/runtime/builder.rs
1,401
1,460
tokio-rs/tokio:tokio/src/runtime/builder.rs:37
unhandled_panic: self.unhandled_panic.clone(), disable_lifo_slot: self.disable_lifo_slot, seed_generator: seed_generator_1, metrics_poll_count_histogram: self.metrics_poll_count_histogram_builder(), }, ); let handle = H...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
512e9decfb683d22f4a145459142542caa0894c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/runtime/builder.rs
1,441
1,500
tokio-rs/tokio:tokio/src/runtime/builder.rs:38
Config { before_park: self.before_park.clone(), after_unpark: self.after_unpark.clone(), before_spawn: self.before_spawn.clone(), after_termination: self.after_termination.clone(), global_queue_interv...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
512e9decfb683d22f4a145459142542caa0894c9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/512e9decfb683d22f4a145459142542caa0894c9/tokio/src/runtime/builder.rs
1,481
1,519
tokio-rs/tokio:tokio/src/runtime/builder.rs:1
#![cfg_attr(loom, allow(unused_imports))] use crate::runtime::handle::Handle; #[cfg(tokio_unstable)] use crate::runtime::TaskMeta; use crate::runtime::{blocking, driver, Callback, HistogramBuilder, Runtime, TaskCallback}; use crate::util::rand::{RngSeed, RngSeedGenerator}; use std::fmt; use std::io; use std::time::Du...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
1
60
tokio-rs/tokio:tokio/src/runtime/builder.rs:2
/// /// // use runtime ... /// } /// ``` pub struct Builder { /// Runtime type kind: Kind, /// Whether or not to enable the I/O driver enable_io: bool, nevents: usize, /// Whether or not to enable the time driver enable_time: bool, /// Whether or not the clock should start paused....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
41
100
tokio-rs/tokio:tokio/src/runtime/builder.rs:3
/// To run after each thread is unparked. pub(super) after_unpark: Option<Callback>, /// To run before each task is spawned. pub(super) before_spawn: Option<TaskCallback>, /// To run after each task is terminated. pub(super) after_termination: Option<TaskCallback>, /// Customizable keep alive...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
81
140
tokio-rs/tokio:tokio/src/runtime/builder.rs:5
/// // The panic on the first task is forwarded to the `JoinHandle` /// assert!(task1.await.is_err()); /// /// // The second task completes normally /// assert!(task2.await.is_ok()); /// }) /// # } /// ``` /// /// [`JoinHandle`]: st...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
161
220
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
/// /// [`JoinHandle`]: struct@crate::task::JoinHandle ShutdownRuntime, } } pub(crate) type ThreadNameFn = std::sync::Arc<dyn Fn() -> String + Send + Sync + 'static>; #[derive(Clone, Copy)] pub(crate) enum Kind { CurrentThread, #[cfg(feature = "rt-multi-thread")] MultiThread, #[cfg...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
#[cfg_attr(docsrs, doc(cfg(feature = "rt-multi-thread")))] pub fn new_multi_thread() -> Builder { // The number `61` is fairly arbitrary. I believe this value was copied from golang. Builder::new(Kind::MultiThread, 61) } cfg_unstable! { /// Returns a new builder with the alternate m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:8
// The clock starts not-paused start_paused: false, // Read from environment variable first in multi-threaded mode. // Default to lazy auto-detection (one thread per CPU core) worker_threads: None, max_blocking_threads: 512, // Default thread na...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
281
340
tokio-rs/tokio:tokio/src/runtime/builder.rs:9
#[cfg(tokio_unstable)] unhandled_panic: UnhandledPanic::Ignore, metrics_poll_count_histogram_enable: false, metrics_poll_count_histogram: HistogramBuilder::default(), disable_lifo_slot: false, } } /// Enables both I/O and time drivers. /// /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
/// [`spawn_blocking`]: fn@crate::task::spawn_blocking /// [`fs`]: mod@crate::fs /// [`ToSocketAddrs`]: trait@crate::net::ToSocketAddrs /// [`Stdout`]: struct@crate::io::Stdout /// [`Stdin`]: struct@crate::io::Stdin /// [`Stderr`]: struct@crate::io::Stderr /// [`worker_threads`]: Self::worker_th...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
/// .build(); /// # } /// ``` pub fn thread_stack_size(&mut self, val: usize) -> &mut Self { self.thread_stack_size = Some(val); self } /// Executes function `f` after each thread is started but before it starts /// doing work. /// /// This is intended for bookkeepin...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
521
580
tokio-rs/tokio:tokio/src/runtime/builder.rs:17
/// .build() /// .unwrap(); /// /// runtime.block_on(async { /// barrier.wait().await; /// }) /// # } /// ``` #[cfg(not(loom))] pub fn on_thread_park<F>(&mut self, f: F) -> &mut Self where F: Fn() + Send + Sync + 'static, { self.before_park = Some(s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
641
700
tokio-rs/tokio:tokio/src/runtime/builder.rs:18
/// }) /// # } /// ``` #[cfg(not(loom))] pub fn on_thread_unpark<F>(&mut self, f: F) -> &mut Self where F: Fn() + Send + Sync + 'static, { self.after_unpark = Some(std::sync::Arc::new(f)); self } /// Executes function `f` just before a task is spawned. /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
681
740
tokio-rs/tokio:tokio/src/runtime/builder.rs:19
/// for _ in 0..64 { /// tokio::task::yield_now().await; /// } /// }) /// # } /// ``` #[cfg(all(not(loom), tokio_unstable))] pub fn on_task_spawn<F>(&mut self, f: F) -> &mut Self where F: Fn(&TaskMeta<'_>) + Send + Sync + 'static, { self.before_spawn =...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
721
780
tokio-rs/tokio:tokio/src/runtime/builder.rs:20
/// tokio::task::spawn(std::future::ready(())); /// /// for _ in 0..64 { /// tokio::task::yield_now().await; /// } /// }) /// # } /// ``` #[cfg(all(not(loom), tokio_unstable))] pub fn on_task_terminate<F>(&mut self, f: F) -> &mut Self where F: Fn(&Task...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
761
820
tokio-rs/tokio:tokio/src/runtime/builder.rs:21
} fn get_cfg(&self, workers: usize) -> driver::Cfg { driver::Cfg { enable_pause_time: match self.kind { Kind::CurrentThread => true, #[cfg(feature = "rt-multi-thread")] Kind::MultiThread => false, #[cfg(all(tokio_unstable, feature ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
801
860
tokio-rs/tokio:tokio/src/runtime/builder.rs:30
/// The last bucket tracks all greater values that fall out of other /// ranges. So, configuring the histogram using a linear scale, /// resolution of 50ms, and 10 buckets, the 10th bucket will track task /// polls that take more than 450ms to complete. /// /// **Default:** 10 ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/builder.rs:31
let blocking_spawner = blocking_pool.spawner().clone(); // Generate a rng seed for this runtime. let seed_generator_1 = self.seed_generator.next_generator(); let seed_generator_2 = self.seed_generator.next_generator(); // And now put a single-threaded scheduler on top of the timer. Whe...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
1,201
1,260
tokio-rs/tokio:tokio/src/runtime/builder.rs:33
/// /// let rt = runtime::Builder::new_current_thread() /// .enable_io() /// .max_io_events_per_tick(1024) /// .build() /// .unwrap(); /// ``` pub fn max_io_events_per_tick(&mut self, capacity: usize) -> &mut Self { self.nevents = capac...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
1,281
1,340
tokio-rs/tokio:tokio/src/runtime/builder.rs:34
/// /// Pausing time requires the current-thread runtime; construction of /// the runtime will panic otherwise. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_current_thread() /// .enable_t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
1,321
1,380
tokio-rs/tokio:tokio/src/runtime/builder.rs:35
let seed_generator_2 = self.seed_generator.next_generator(); let (scheduler, handle, launch) = MultiThread::new( core_threads, driver, driver_handle, blocking_spawner, seed_generator_2, Config { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
1,361
1,420
tokio-rs/tokio:tokio/src/runtime/builder.rs:36
let (driver, driver_handle) = driver::Driver::new(self.get_cfg(core_threads))?; // Create the blocking pool let blocking_pool = blocking::create_blocking_pool(self, self.max_blocking_threads + core_threads); let blocking_spawner = blocking_pool.spawne...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
1,401
1,456
tokio-rs/tokio:tokio/src/runtime/builder.rs:37
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Builder") .field("worker_threads", &self.worker_threads) .field("max_blocking_threads", &self.max_blocking_threads) .field( "thread_name", &"<dyn Fn() -> String + Se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/builder.rs
1,441
1,456
tokio-rs/tokio:tokio/src/runtime/builder.rs:1
use crate::runtime::handle::Handle; use crate::runtime::{blocking, driver, Callback, HistogramBuilder, Runtime}; use crate::util::rand::{RngSeed, RngSeedGenerator}; use std::fmt; use std::io; use std::time::Duration; /// Builds Tokio Runtime with custom configuration values. /// /// Methods can be chained in order to...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
1
60
tokio-rs/tokio:tokio/src/runtime/builder.rs:2
pub struct Builder { /// Runtime type kind: Kind, /// Whether or not to enable the I/O driver enable_io: bool, nevents: usize, /// Whether or not to enable the time driver enable_time: bool, /// Whether or not the clock should start paused. start_paused: bool, /// The number ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
41
100
tokio-rs/tokio:tokio/src/runtime/builder.rs:3
/// Customizable keep alive timeout for `BlockingPool` pub(super) keep_alive: Option<Duration>, /// How many ticks before pulling a task from the global/remote queue? /// /// When `None`, the value is unspecified and behavior details are left to /// the scheduler. Each scheduler flavor could choose...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
81
140
tokio-rs/tokio:tokio/src/runtime/builder.rs:5
Ignore, /// The runtime should immediately shutdown if a spawned task panics. /// /// The runtime will immediately shutdown even if the panicked task's /// [`JoinHandle`] is still available. All further spawned tasks will be /// immediately dropped and call to [`Runtime::block_o...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
161
220
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
CurrentThread, #[cfg(feature = "rt-multi-thread")] MultiThread, #[cfg(all(tokio_unstable, feature = "rt-multi-thread"))] MultiThreadAlt, } impl Builder { /// Returns a new builder with the current thread scheduler selected. /// /// Configuration methods can be chained on the return value. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
/// The alternate multi threaded scheduler is an in-progress /// candidate to replace the existing multi threaded scheduler. It /// currently does not scale as well to 16+ processors. /// /// This runtime flavor is currently **not considered production /// ready**. /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:8
// Default thread name thread_name: std::sync::Arc::new(|| "tokio-runtime-worker".into()), // Do not set a stack size by default thread_stack_size: None, // No worker thread callbacks after_start: None, before_stop: None, before_park:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
281
340
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
self } /// Sets name of threads spawned by the `Runtime`'s thread pool. /// /// The default name is "tokio-runtime-worker". /// /// # Examples /// /// ``` /// # use tokio::runtime; /// /// # pub fn main() { /// let rt = runtime::Builder::new_multi_thread() /// .t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
/// .build(); /// # } /// ``` pub fn thread_name_fn<F>(&mut self, f: F) -> &mut Self where F: Fn() -> String + Send + Sync + 'static, { self.thread_name = std::sync::Arc::new(f); self } /// Sets the stack size (in bytes) for worker threads. /// /// The ac...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
481
540
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
/// # Examples /// /// ``` /// # use tokio::runtime; /// # pub fn main() { /// let runtime = runtime::Builder::new_multi_thread() /// .on_thread_start(|| { /// println!("thread started"); /// }) /// .build(); /// # } /// ``` #[cfg(not(loom))] pub f...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
521
580
tokio-rs/tokio:tokio/src/runtime/builder.rs:17
self.before_park = Some(std::sync::Arc::new(f)); self } /// Executes function `f` just after a thread unparks (starts executing tasks). /// /// This is intended for bookkeeping and monitoring use cases; note that work /// in this callback will increase latencies when the application has all...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
641
700
tokio-rs/tokio:tokio/src/runtime/builder.rs:18
/// /// The returned `Runtime` instance is ready to spawn tasks. /// /// # Examples /// /// ``` /// use tokio::runtime::Builder; /// /// let rt = Builder::new_multi_thread().build().unwrap(); /// /// rt.block_on(async { /// println!("Hello from the Tokio runtime"); /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
681
740
tokio-rs/tokio:tokio/src/runtime/builder.rs:27
/// use tokio::runtime; /// use std::time::Duration; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_metrics_poll_count_histogram() /// .metrics_poll_count_histogram_resolution(Duration::from_micros(100)) /// .build() /// .unwrap(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/builder.rs:28
pub fn metrics_poll_count_histogram_buckets(&mut self, buckets: usize) -> &mut Self { self.metrics_poll_count_histogram.num_buckets = buckets; self } } cfg_loom! { pub(crate) fn local_queue_capacity(&mut self, value: usize) -> &mut Self { assert!(value.is_pow...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/builder.rs:29
global_queue_interval: self.global_queue_interval, event_interval: self.event_interval, local_queue_capacity: self.local_queue_capacity, #[cfg(tokio_unstable)] unhandled_panic: self.unhandled_panic.clone(), disable_lifo_slot: self.disable_l...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/builder.rs:31
/// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_time() /// .build() /// .unwrap(); /// ``` pub fn enable_time(&mut self) -> &mut Self { self.enable...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
1,201
1,260
tokio-rs/tokio:tokio/src/runtime/builder.rs:32
} cfg_rt_multi_thread! { impl Builder { fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{Config, runtime::Scheduler}; use crate::runtime::scheduler::{self, MultiThread}; let core_threads = sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
1,241
1,300
tokio-rs/tokio:tokio/src/runtime/builder.rs:33
); let handle = Handle { inner: scheduler::Handle::MultiThread(handle) }; // Spawn the thread pool workers let _enter = handle.enter(); launch.launch(); Ok(Runtime::from_parts(Scheduler::MultiThread(scheduler), handle, blocking_pool)) } cfg...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
1,281
1,340
tokio-rs/tokio:tokio/src/runtime/builder.rs:34
local_queue_capacity: self.local_queue_capacity, #[cfg(tokio_unstable)] unhandled_panic: self.unhandled_panic.clone(), disable_lifo_slot: self.disable_lifo_slot, seed_generator: seed_generator_1, metr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
65d0e08d39f06eba88661d3d6de665b14588f30d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/65d0e08d39f06eba88661d3d6de665b14588f30d/tokio/src/runtime/builder.rs
1,321
1,352
tokio-rs/tokio:tokio/src/runtime/builder.rs:18
/// /// The returned `Runtime` instance is ready to spawn tasks. /// /// # Examples /// /// ``` /// use tokio::runtime::Builder; /// /// let rt = Builder::new_multi_thread().build().unwrap(); /// /// rt.block_on(async { /// println!("Hello from the Tokio runtime"); /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
9ed595767d01c400955122d276b34ab52b3a6aab
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9ed595767d01c400955122d276b34ab52b3a6aab/tokio/src/runtime/builder.rs
681
740
tokio-rs/tokio:tokio/src/runtime/builder.rs:27
/// use std::time::Duration; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_metrics_poll_count_histogram() /// .metrics_poll_count_histogram_resolution(Duration::from_micros(100)) /// .build() /// .unwrap(); /// ``` pub f...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
9ed595767d01c400955122d276b34ab52b3a6aab
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9ed595767d01c400955122d276b34ab52b3a6aab/tokio/src/runtime/builder.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/builder.rs:28
self.metrics_poll_count_histogram.num_buckets = buckets; self } } cfg_loom! { pub(crate) fn local_queue_capacity(&mut self, value: usize) -> &mut Self { assert!(value.is_power_of_two()); self.local_queue_capacity = value; self } } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
9ed595767d01c400955122d276b34ab52b3a6aab
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9ed595767d01c400955122d276b34ab52b3a6aab/tokio/src/runtime/builder.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/builder.rs:29
event_interval: self.event_interval, local_queue_capacity: self.local_queue_capacity, #[cfg(tokio_unstable)] unhandled_panic: self.unhandled_panic.clone(), disable_lifo_slot: self.disable_lifo_slot, seed_generator: seed_generator_1, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
9ed595767d01c400955122d276b34ab52b3a6aab
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9ed595767d01c400955122d276b34ab52b3a6aab/tokio/src/runtime/builder.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/builder.rs:31
/// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_time() /// .build() /// .unwrap(); /// ``` pub fn enable_time(&mut self) -> &mut Self { self.enable_time = true; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
9ed595767d01c400955122d276b34ab52b3a6aab
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9ed595767d01c400955122d276b34ab52b3a6aab/tokio/src/runtime/builder.rs
1,201
1,260
tokio-rs/tokio:tokio/src/runtime/builder.rs:32
cfg_rt_multi_thread! { impl Builder { fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{Config, runtime::Scheduler}; use crate::runtime::scheduler::{self, MultiThread}; let core_threads = self.w...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
9ed595767d01c400955122d276b34ab52b3a6aab
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9ed595767d01c400955122d276b34ab52b3a6aab/tokio/src/runtime/builder.rs
1,241
1,300
tokio-rs/tokio:tokio/src/runtime/builder.rs:33
let handle = Handle { inner: scheduler::Handle::MultiThread(handle) }; // Spawn the thread pool workers let _enter = handle.enter(); launch.launch(); Ok(Runtime::from_parts(Scheduler::MultiThread(scheduler), handle, blocking_pool)) } cfg_unstable! { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
9ed595767d01c400955122d276b34ab52b3a6aab
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9ed595767d01c400955122d276b34ab52b3a6aab/tokio/src/runtime/builder.rs
1,281
1,340
tokio-rs/tokio:tokio/src/runtime/builder.rs:34
#[cfg(tokio_unstable)] unhandled_panic: self.unhandled_panic.clone(), disable_lifo_slot: self.disable_lifo_slot, seed_generator: seed_generator_1, metrics_poll_count_histogram: self.metrics_poll_count_histogram_builder(), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
9ed595767d01c400955122d276b34ab52b3a6aab
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9ed595767d01c400955122d276b34ab52b3a6aab/tokio/src/runtime/builder.rs
1,321
1,351
tokio-rs/tokio:tokio/src/runtime/builder.rs:5
Ignore, /// The runtime should immediately shutdown if a spawned task panics. /// /// The runtime will immediately shutdown even if the panicked task's /// [`JoinHandle`] is still available. All further spawned tasks will be /// immediately dropped and call to [`Runtime::block_o...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
161
220
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
CurrentThread, #[cfg(all(feature = "rt-multi-thread", not(target_os = "wasi")))] MultiThread, #[cfg(all(tokio_unstable, feature = "rt-multi-thread", not(target_os = "wasi")))] MultiThreadAlt, } impl Builder { /// Returns a new builder with the current thread scheduler selected. /// /// Conf...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
/// /// The alternate multi threaded scheduler is an in-progress /// candidate to replace the existing multi threaded scheduler. It /// currently does not scale as well to 16+ processors. /// /// This runtime flavor is currently **not considered production ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:8
max_blocking_threads: 512, // Default thread name thread_name: std::sync::Arc::new(|| "tokio-runtime-worker".into()), // Do not set a stack size by default thread_stack_size: None, // No worker thread callbacks after_start: None, bef...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
281
340
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
assert!(val > 0, "Max blocking threads cannot be set to 0"); self.max_blocking_threads = val; self } /// Sets name of threads spawned by the `Runtime`'s thread pool. /// /// The default name is "tokio-runtime-worker". /// /// # Examples /// /// ``` /// # use tokio::r...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
/// format!("my-pool-{}", id) /// }) /// .build(); /// # } /// ``` pub fn thread_name_fn<F>(&mut self, f: F) -> &mut Self where F: Fn() -> String + Send + Sync + 'static, { self.thread_name = std::sync::Arc::new(f); self } /// Sets the stack si...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
481
540
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
/// This is intended for bookkeeping and monitoring use cases. /// /// # Examples /// /// ``` /// # use tokio::runtime; /// # pub fn main() { /// let runtime = runtime::Builder::new_multi_thread() /// .on_thread_start(|| { /// println!("thread started"); /// }) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
521
580
tokio-rs/tokio:tokio/src/runtime/builder.rs:17
F: Fn() + Send + Sync + 'static, { self.before_park = Some(std::sync::Arc::new(f)); self } /// Executes function `f` just after a thread unparks (starts executing tasks). /// /// This is intended for bookkeeping and monitoring use cases; note that work /// in this callback will ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
641
700
tokio-rs/tokio:tokio/src/runtime/builder.rs:18
/// Creates the configured `Runtime`. /// /// The returned `Runtime` instance is ready to spawn tasks. /// /// # Examples /// /// ``` /// use tokio::runtime::Builder; /// /// let rt = Builder::new_multi_thread().build().unwrap(); /// /// rt.block_on(async { /// print...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
681
740
tokio-rs/tokio:tokio/src/runtime/builder.rs:27
/// ``` /// use tokio::runtime; /// use std::time::Duration; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_metrics_poll_count_histogram() /// .metrics_poll_count_histogram_resolution(Duration::from_micros(100)) /// .build() ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/builder.rs:28
/// ``` pub fn metrics_poll_count_histogram_buckets(&mut self, buckets: usize) -> &mut Self { self.metrics_poll_count_histogram.num_buckets = buckets; self } } cfg_loom! { pub(crate) fn local_queue_capacity(&mut self, value: usize) -> &mut Self { asse...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/builder.rs:29
after_unpark: self.after_unpark.clone(), global_queue_interval: self.global_queue_interval, event_interval: self.event_interval, local_queue_capacity: self.local_queue_capacity, #[cfg(tokio_unstable)] unhandled_panic: self.unhandled_panic.c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/builder.rs:30
/// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_io() /// .build() /// .unwrap(); /// ``` pub fn enable_io(&mut self) -> &mut Self { self.enable_io = true; sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/builder.rs:31
/// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_time() /// .build() /// .unwrap(); /// ``` pub fn enable_time(&mut self) -> &mut Self { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
1,201
1,260
tokio-rs/tokio:tokio/src/runtime/builder.rs:32
} } cfg_rt_multi_thread! { impl Builder { fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{Config, runtime::Scheduler}; use crate::runtime::scheduler::{self, MultiThread}; let core_threads = s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
1,241
1,300
tokio-rs/tokio:tokio/src/runtime/builder.rs:33
}, ); let handle = Handle { inner: scheduler::Handle::MultiThread(handle) }; // Spawn the thread pool workers let _enter = handle.enter(); launch.launch(); Ok(Runtime::from_parts(Scheduler::MultiThread(scheduler), handle, blocking_pool)) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
1,281
1,340
tokio-rs/tokio:tokio/src/runtime/builder.rs:34
event_interval: self.event_interval, local_queue_capacity: self.local_queue_capacity, #[cfg(tokio_unstable)] unhandled_panic: self.unhandled_panic.clone(), disable_lifo_slot: self.disable_lifo_slot, s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b6d74ac4ebe9cca0a8f0d964bf8f51a2e0807e26/tokio/src/runtime/builder.rs
1,321
1,353
tokio-rs/tokio:tokio/src/runtime/builder.rs:27
/// let rt = runtime::Builder::new_multi_thread() /// .enable_metrics_poll_count_histogram() /// .metrics_poll_count_histogram_resolution(Duration::from_micros(100)) /// .build() /// .unwrap(); /// ``` pub fn metrics_poll_count_histogram_resolution(&mut se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/builder.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/builder.rs:28
} } cfg_loom! { pub(crate) fn local_queue_capacity(&mut self, value: usize) -> &mut Self { assert!(value.is_power_of_two()); self.local_queue_capacity = value; self } } fn build_current_thread_runtime(&mut self) -> io::Result<Runtime> { use c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/builder.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/builder.rs:29
#[cfg(tokio_unstable)] unhandled_panic: self.unhandled_panic.clone(), disable_lifo_slot: self.disable_lifo_slot, seed_generator: seed_generator_1, metrics_poll_count_histogram: self.metrics_poll_count_histogram_builder(), }, ); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/builder.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/builder.rs:30
/// let rt = runtime::Builder::new_multi_thread() /// .enable_io() /// .build() /// .unwrap(); /// ``` pub fn enable_io(&mut self) -> &mut Self { self.enable_io = true; self } /// Enables the I/O driver and configures the max n...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/builder.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/builder.rs:31
/// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_time() /// .build() /// .unwrap(); /// ``` pub fn enable_time(&mut self) -> &mut Self { self.enable_time = true; self } } } c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/builder.rs
1,201
1,260
tokio-rs/tokio:tokio/src/runtime/builder.rs:32
impl Builder { fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{Config, runtime::Scheduler}; use crate::runtime::scheduler::{self, MultiThread}; let core_threads = self.worker_threads.unwrap_or_els...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/builder.rs
1,241
1,300
tokio-rs/tokio:tokio/src/runtime/builder.rs:33
// Spawn the thread pool workers let _enter = handle.enter(); launch.launch(); Ok(Runtime::from_parts(Scheduler::MultiThread(scheduler), handle, blocking_pool)) } cfg_unstable! { fn build_alt_threaded_runtime(&mut self) -> io::Result<Runtime> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/builder.rs
1,281
1,340
tokio-rs/tokio:tokio/src/runtime/builder.rs:34
disable_lifo_slot: self.disable_lifo_slot, seed_generator: seed_generator_1, metrics_poll_count_histogram: self.metrics_poll_count_histogram_builder(), }, ); Ok(Runtime::from_parts(Scheduler::MultiThreadAlt(scheduler), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
328a02c1ce08df6e888b19c81cc81d59422af5ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/328a02c1ce08df6e888b19c81cc81d59422af5ef/tokio/src/runtime/builder.rs
1,321
1,349
tokio-rs/tokio:tokio/src/runtime/builder.rs:27
pub fn metrics_poll_count_histogram_resolution(&mut self, resolution: Duration) -> &mut Self { assert!(resolution > Duration::from_secs(0)); // Sanity check the argument and also make the cast below safe. assert!(resolution <= Duration::from_secs(1)); let resolution = re...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
d51f16855bce90c3c73ae199c7d6bdb340297e99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d51f16855bce90c3c73ae199c7d6bdb340297e99/tokio/src/runtime/builder.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/builder.rs:28
self.local_queue_capacity = value; self } } fn build_current_thread_runtime(&mut self) -> io::Result<Runtime> { use crate::runtime::scheduler::{self, CurrentThread}; use crate::runtime::{runtime::Scheduler, Config}; let (driver, driver_handle) = driver::Driver::new(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
d51f16855bce90c3c73ae199c7d6bdb340297e99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d51f16855bce90c3c73ae199c7d6bdb340297e99/tokio/src/runtime/builder.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/builder.rs:29
); let handle = Handle { inner: scheduler::Handle::CurrentThread(handle), }; Ok(Runtime::from_parts( Scheduler::CurrentThread(scheduler), handle, blocking_pool, )) } fn metrics_poll_count_histogram_builder(&self) -> Option<Histog...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
d51f16855bce90c3c73ae199c7d6bdb340297e99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d51f16855bce90c3c73ae199c7d6bdb340297e99/tokio/src/runtime/builder.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/builder.rs:30
self.enable_io = true; self } /// Enables the I/O driver and configures the max number of events to be /// processed per tick. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_curren...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
d51f16855bce90c3c73ae199c7d6bdb340297e99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d51f16855bce90c3c73ae199c7d6bdb340297e99/tokio/src/runtime/builder.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/builder.rs:31
/// ``` pub fn enable_time(&mut self) -> &mut Self { self.enable_time = true; self } } } cfg_test_util! { impl Builder { /// Controls if the runtime's clock starts paused or advancing. /// /// Pausing time requires the current-thread runtime; cons...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
d51f16855bce90c3c73ae199c7d6bdb340297e99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d51f16855bce90c3c73ae199c7d6bdb340297e99/tokio/src/runtime/builder.rs
1,201
1,260
tokio-rs/tokio:tokio/src/runtime/builder.rs:32
let core_threads = self.worker_threads.unwrap_or_else(num_cpus); let (driver, driver_handle) = driver::Driver::new(self.get_cfg())?; // Create the blocking pool let blocking_pool = blocking::create_blocking_pool(self, self.max_blocking_threads + core_threads); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
d51f16855bce90c3c73ae199c7d6bdb340297e99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d51f16855bce90c3c73ae199c7d6bdb340297e99/tokio/src/runtime/builder.rs
1,241
1,300
tokio-rs/tokio:tokio/src/runtime/builder.rs:33
} cfg_unstable! { fn build_alt_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{Config, runtime::Scheduler}; use crate::runtime::scheduler::MultiThreadAlt; let core_threads = se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
d51f16855bce90c3c73ae199c7d6bdb340297e99
github
async-runtime
https://github.com/tokio-rs/tokio/blob/d51f16855bce90c3c73ae199c7d6bdb340297e99/tokio/src/runtime/builder.rs
1,281
1,340
tokio-rs/tokio:tokio/src/runtime/builder.rs:27
} /// Sets the number of buckets for the histogram tracking the /// distribution of task poll times. /// /// The last bucket tracks all greater values that fall out of other /// ranges. So, configuring the histogram using a linear scale, /// resolution of 50ms, and 10 bu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/builder.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/builder.rs:28
let (driver, driver_handle) = driver::Driver::new(self.get_cfg())?; // Blocking pool let blocking_pool = blocking::create_blocking_pool(self, self.max_blocking_threads); let blocking_spawner = blocking_pool.spawner().clone(); // Generate a rng seed for this runtime. let seed_ge...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/builder.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/builder.rs:29
handle, blocking_pool, )) } fn metrics_poll_count_histogram_builder(&self) -> Option<HistogramBuilder> { if self.metrics_poll_count_histogram_enable { Some(self.metrics_poll_count_histogram.clone()) } else { None } } } cfg_io_driver! { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/builder.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/builder.rs:30
/// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_current_thread() /// .enable_io() /// .max_io_events_per_tick(1024) /// .build() /// .unwrap(); /// ``` pub fn max_io_events_per_tick(&mut self, capa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/builder.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/builder.rs:31
cfg_test_util! { impl Builder { /// Controls if the runtime's clock starts paused or advancing. /// /// Pausing time requires the current-thread runtime; construction of /// the runtime will panic otherwise. /// /// # Examples /// /// ``` /// u...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
131e7b4e49c8849298ba54b4e0c99f4b81d869e3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/131e7b4e49c8849298ba54b4e0c99f4b81d869e3/tokio/src/runtime/builder.rs
1,201
1,260