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:32
// 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(); let (scheduler, handle, launch) = MultiThread::new( core_threads, 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,241
1,300
tokio-rs/tokio:tokio/src/runtime/builder.rs:33
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_...
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,281
1,335
tokio-rs/tokio:tokio/src/runtime/builder.rs:34
fmt.debug_struct("Builder") .field("worker_threads", &self.worker_threads) .field("max_blocking_threads", &self.max_blocking_threads) .field( "thread_name", &"<dyn Fn() -> String + Send + Sync + 'static>", ) .field("thread_stack...
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,321
1,335
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
3a4aef17b2c70d255affa51eb473efcf703896e4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/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 t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
3a4aef17b2c70d255affa51eb473efcf703896e4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/builder.rs
81
140
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
3a4aef17b2c70d255affa51eb473efcf703896e4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3a4aef17b2c70d255affa51eb473efcf703896e4/tokio/src/runtime/builder.rs
681
740
tokio-rs/tokio:tokio/src/runtime/builder.rs:32
// 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(); let (scheduler, handle, launch) = MultiThread::new( core_threads, driver, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
3468b4b72f4e5a5ae89b1ff059ccde576dceb459
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3468b4b72f4e5a5ae89b1ff059ccde576dceb459/tokio/src/runtime/builder.rs
1,241
1,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
f5f2b58b8dc6fcfb22d9c917d6c87410adab81e9
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f5f2b58b8dc6fcfb22d9c917d6c87410adab81e9/tokio/src/runtime/builder.rs
281
340
tokio-rs/tokio:tokio/src/runtime/builder.rs:11
self } /// Specifies the limit for additional threads spawned by the Runtime. /// /// These threads are used for blocking operations like tasks spawned /// through [`spawn_blocking`]. Unlike the [`worker_threads`], they are not /// always active and will exit if left idle for too long. You can ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8832e936b1b86946ce802c5494bd8d575f8ba3a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/builder.rs
401
460
tokio-rs/tokio:tokio/src/runtime/builder.rs:17
/// more than once replaces the last callback defined, rather than adding to it. /// /// # Examples /// /// ``` /// # use tokio::runtime; /// # pub fn main() { /// let runtime = runtime::Builder::new_multi_thread() /// .on_thread_unpark(|| { /// println!("thread unparking...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8832e936b1b86946ce802c5494bd8d575f8ba3a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/builder.rs
641
700
tokio-rs/tokio:tokio/src/runtime/builder.rs:18
/// println!("Hello from the Tokio runtime"); /// }); /// ``` pub fn build(&mut self) -> io::Result<Runtime> { match &self.kind { Kind::CurrentThread => self.build_current_thread_runtime(), #[cfg(all(feature = "rt-multi-thread", not(target_os = "wasi")))] Kind...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8832e936b1b86946ce802c5494bd8d575f8ba3a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/builder.rs
681
740
tokio-rs/tokio:tokio/src/runtime/builder.rs:26
/// smallest bucket range. /// /// Note that, when using log scale, the resolution is rounded up to the /// nearest power of 2 in nanoseconds. /// /// **Default:** 100 microseconds. /// /// # Examples /// /// ``` /// use tokio::runtime; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8832e936b1b86946ce802c5494bd8d575f8ba3a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/builder.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/builder.rs:27
/// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_metrics_poll_count_histogram() /// .metrics_poll_count_histogram_buckets(15) /// .build() /// .unwrap(); /// ``` pub fn me...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8832e936b1b86946ce802c5494bd8d575f8ba3a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/builder.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/builder.rs:28
// the reactor to generate some new stimuli for the futures to continue // in their life. let (scheduler, handle) = CurrentThread::new( driver, driver_handle, blocking_spawner, seed_generator_2, Config { before_park: self.before...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8832e936b1b86946ce802c5494bd8d575f8ba3a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/builder.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/builder.rs:31
/// .enable_time() /// .start_paused(true) /// .build() /// .unwrap(); /// ``` pub fn start_paused(&mut self, start_paused: bool) -> &mut Self { self.start_paused = start_paused; self } } } cfg_rt_multi_thread! { impl Build...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8832e936b1b86946ce802c5494bd8d575f8ba3a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/builder.rs
1,201
1,260
tokio-rs/tokio:tokio/src/runtime/builder.rs:32
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: se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8832e936b1b86946ce802c5494bd8d575f8ba3a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/builder.rs
1,241
1,300
tokio-rs/tokio:tokio/src/runtime/builder.rs:33
let (scheduler, handle) = MultiThreadAlt::new( core_threads, driver, driver_handle, blocking_spawner, seed_generator_2, Config { before_park: self.before_park.clone(), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
8832e936b1b86946ce802c5494bd8d575f8ba3a3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/builder.rs
1,281
1,323
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
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/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 t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
81
140
tokio-rs/tokio:tokio/src/runtime/builder.rs:5
/// 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_on`] will panic. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
161
220
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
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. /// /// Configuration methods can be chained on the return value. /// /// To spawn non-`Send`...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
/// 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**. /// /// Configuration methods can be chaine...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/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
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
281
340
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
let val = val.into(); self.thread_name = std::sync::Arc::new(move || val.clone()); self } /// Sets a function used to generate the name of threads spawned by the `Runtime`'s thread pool. /// /// The default name fn is `|| "tokio-runtime-worker".into()`. /// /// # Examples //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
/// # Examples /// /// ``` /// # use tokio::runtime; /// /// # pub fn main() { /// let rt = runtime::Builder::new_multi_thread() /// .thread_stack_size(32 * 1024) /// .build(); /// # } /// ``` pub fn thread_stack_size(&mut self, val: usize) -> &mut Self { self...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
481
540
tokio-rs/tokio:tokio/src/runtime/builder.rs:16
/// let barrier = barrier.clone(); /// move || { /// let barrier = barrier.clone(); /// if once.swap(false, Ordering::Relaxed) { /// tokio::spawn(async move { barrier.wait().await; }); /// } /// } /// }) /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
601
660
tokio-rs/tokio:tokio/src/runtime/builder.rs:17
/// .on_thread_unpark(|| { /// println!("thread unparking"); /// }) /// .build(); /// /// runtime.unwrap().block_on(async { /// tokio::task::yield_now().await; /// println!("Hello from Tokio!"); /// }) /// # } /// ``` #[cfg(not(loom))] pub fn on_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
641
700
tokio-rs/tokio:tokio/src/runtime/builder.rs:18
#[cfg(all(tokio_unstable, feature = "rt-multi-thread", not(target_os = "wasi")))] Kind::MultiThreadAlt => self.build_alt_threaded_runtime(), } } fn get_cfg(&self) -> driver::Cfg { driver::Cfg { enable_pause_time: match self.kind { Kind::CurrentThread => t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
681
740
tokio-rs/tokio:tokio/src/runtime/builder.rs:26
/// /// ``` /// 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)) /// .buil...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/builder.rs:27
/// .unwrap(); /// ``` pub fn metrics_poll_count_histogram_buckets(&mut self, buckets: usize) -> &mut Self { self.metrics_poll_count_histogram.num_buckets = buckets; self } } fn build_current_thread_runtime(&mut self) -> io::Result<Runtime> { use crat...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/builder.rs:28
metrics_poll_count_histogram: self.metrics_poll_count_histogram_builder(), }, ); let handle = Handle { inner: scheduler::Handle::CurrentThread(handle), }; Ok(Runtime::from_parts( Scheduler::CurrentThread(scheduler), handle, bl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/builder.rs:30
/// .build() /// .unwrap(); /// ``` 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. /// /// Pa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/builder.rs:31
use crate::runtime::scheduler::{self, MultiThread}; 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_blo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
1,201
1,260
tokio-rs/tokio:tokio/src/runtime/builder.rs:32
Ok(Runtime::from_parts(Scheduler::MultiThread(scheduler), handle, blocking_pool)) } cfg_unstable! { fn build_alt_threaded_runtime(&mut self) -> io::Result<Runtime> { use crate::loom::sys::num_cpus; use crate::runtime::{Config, runtime::Scheduler}; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/builder.rs
1,241
1,300
tokio-rs/tokio:tokio/src/runtime/builder.rs:5
/// 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_on`] will panic. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
4165601b1bbaa7c29cbfb319fe75a9adddf4085e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/builder.rs
161
220
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
MultiThread, #[cfg(all(tokio_unstable, feature = "rt-multi-thread", not(tokio_wasi)))] MultiThreadAlt, } impl Builder { /// Returns a new builder with the current thread scheduler selected. /// /// Configuration methods can be chained on the return value. /// /// To spawn non-`Send` tasks o...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
4165601b1bbaa7c29cbfb319fe75a9adddf4085e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:17
/// .on_thread_unpark(|| { /// println!("thread unparking"); /// }) /// .build(); /// /// runtime.unwrap().block_on(async { /// tokio::task::yield_now().await; /// println!("Hello from Tokio!"); /// }) /// # } /// ``` #[cfg(not(loom))] pub fn on_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
4165601b1bbaa7c29cbfb319fe75a9adddf4085e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/builder.rs
641
700
tokio-rs/tokio:tokio/src/runtime/builder.rs:18
#[cfg(all(tokio_unstable, feature = "rt-multi-thread", not(tokio_wasi)))] Kind::MultiThreadAlt => self.build_alt_threaded_runtime(), } } fn get_cfg(&self) -> driver::Cfg { driver::Cfg { enable_pause_time: match self.kind { Kind::CurrentThread => true, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
4165601b1bbaa7c29cbfb319fe75a9adddf4085e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/builder.rs
681
740
tokio-rs/tokio:tokio/src/runtime/builder.rs:5
/// 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_on`] will panic. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
161
220
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
MultiThread, } impl Builder { /// Returns a new builder with the current thread scheduler selected. /// /// Configuration methods can be chained on the return value. /// /// To spawn non-`Send` tasks on the resulting runtime, combine it with a /// [`LocalSet`]. /// /// [`LocalSet`]: cra...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
kind, // I/O defaults to "off" enable_io: false, nevents: 1024, // Time defaults to "off" enable_time: false, // The clock starts not-paused start_paused: false, // Read from environment variable first in multi-threaded ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:8
unhandled_panic: UnhandledPanic::Ignore, metrics_poll_count_histogram_enable: false, metrics_poll_count_histogram: Default::default(), disable_lifo_slot: false, } } /// Enables both I/O and time drivers. /// /// Doing this is a shorthand for calling `enabl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
281
340
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
/// rt.block_on(async move {}); /// ``` /// /// # Panics /// /// This will panic if `val` is not larger than `0`. #[track_caller] pub fn worker_threads(&mut self, val: usize) -> &mut Self { assert!(val > 0, "Worker threads cannot be set to 0"); self.worker_threads = Some(val)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
361
420
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
/// # } /// ``` 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 actual stack size may be...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
/// /// ``` /// # use tokio::runtime; /// # pub fn main() { /// let runtime = runtime::Builder::new_multi_thread() /// .on_thread_start(|| { /// println!("thread started"); /// }) /// .build(); /// # } /// ``` #[cfg(not(loom))] pub fn on_thread_start<F...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
481
540
tokio-rs/tokio:tokio/src/runtime/builder.rs:16
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 allowed one or /// more runtime threads to go idle. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
601
660
tokio-rs/tokio:tokio/src/runtime/builder.rs:17
/// 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
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
641
700
tokio-rs/tokio:tokio/src/runtime/builder.rs:26
/// resolution of 50ms, and 10 buckets, the 10th bucket will track task /// polls that take more than 450ms to complete. /// /// **Default:** 10 /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/builder.rs:27
let (scheduler, handle) = CurrentThread::new( driver, driver_handle, blocking_spawner, seed_generator_2, Config { before_park: self.before_park.clone(), after_unpark: self.after_unpark.clone(), global_queue_inter...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/builder.rs:29
cfg_time! { impl Builder { /// Enables the time driver. /// /// Doing this enables using `tokio::time` on the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/builder.rs:30
/// .unwrap(); /// ``` pub fn start_paused(&mut self, start_paused: bool) -> &mut Self { self.start_paused = start_paused; self } } } cfg_rt_multi_thread! { impl Builder { fn build_threaded_runtime(&mut self) -> io::Result<Runtime> { use c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/builder.rs:31
#[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
79a7e78c0d4ea5f36d74a773b9023df7d6022b27
github
async-runtime
https://github.com/tokio-rs/tokio/blob/79a7e78c0d4ea5f36d74a773b9023df7d6022b27/tokio/src/runtime/builder.rs
1,201
1,236
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
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/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? pub(super) global_queue_interval: u32, /// How many ticks before yielding to the driver for timer and I/O events? pub(super) event_in...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
81
140
tokio-rs/tokio:tokio/src/runtime/builder.rs:5
/// # Examples /// /// ```should_panic /// use tokio::runtime::{self, UnhandledPanic}; /// /// # pub fn main() { /// let rt = runtime::Builder::new_current_thread() /// .unhandled_panic(UnhandledPanic::ShutdownRuntime) /// .build() /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
161
220
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
/// Configuration methods can be chained on the return value. /// /// To spawn non-`Send` tasks on the resulting runtime, combine it with a /// [`LocalSet`]. /// /// [`LocalSet`]: crate::task::LocalSet pub fn new_current_thread() -> Builder { #[cfg(loom)] const EVENT_INTERVAL: u3...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
// Time defaults to "off" enable_time: false, // 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, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:8
disable_lifo_slot: false, } } /// Enables both I/O and time drivers. /// /// Doing this is a shorthand for calling `enable_io` and `enable_time` /// individually. If additional components are added to Tokio in the future, /// `enable_all` will include these future components. /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
281
340
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
#[track_caller] pub fn worker_threads(&mut self, val: usize) -> &mut Self { assert!(val > 0, "Worker threads cannot be set to 0"); self.worker_threads = Some(val); self } /// Specifies the limit for additional threads spawned by the Runtime. /// /// These threads are used fo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
361
420
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
self.thread_name = std::sync::Arc::new(f); self } /// Sets the stack size (in bytes) for worker threads. /// /// The actual stack size may be greater than this value if the platform /// specifies minimal stack size. /// /// The default stack size for spawned threads is 2 MiB, though...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:13
/// println!("thread started"); /// }) /// .build(); /// # } /// ``` #[cfg(not(loom))] pub fn on_thread_start<F>(&mut self, f: F) -> &mut Self where F: Fn() + Send + Sync + 'static, { self.after_start = Some(std::sync::Arc::new(f)); self } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
481
540
tokio-rs/tokio:tokio/src/runtime/builder.rs:16
/// in this callback will increase latencies when the application has allowed one or /// more runtime threads to go idle. /// /// Note: There can only be one unpark callback for a runtime; calling this function /// more than once replaces the last callback defined, rather than adding to it. /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
601
660
tokio-rs/tokio:tokio/src/runtime/builder.rs:17
/// /// let rt = Builder::new_multi_thread().build().unwrap(); /// /// rt.block_on(async { /// println!("Hello from the Tokio runtime"); /// }); /// ``` pub fn build(&mut self) -> io::Result<Runtime> { match &self.kind { Kind::CurrentThread => self.build_current_thre...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
641
700
tokio-rs/tokio:tokio/src/runtime/builder.rs:25
/// smallest bucket range. /// /// Note that, when using log scale, the resolution is rounded up to the /// nearest power of 2 in nanoseconds. /// /// **Default:** 100 microseconds. /// /// # Examples /// /// ``` /// use tokio::runtime; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
961
1,020
tokio-rs/tokio:tokio/src/runtime/builder.rs:26
/// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_metrics_poll_count_histogram() /// .metrics_poll_count_histogram_buckets(15) /// .build() /// .unwrap(); /// ``` pub fn me...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/builder.rs:27
before_park: self.before_park.clone(), after_unpark: self.after_unpark.clone(), global_queue_interval: self.global_queue_interval, event_interval: self.event_interval, #[cfg(tokio_unstable)] unhandled_panic: self.unhandled_panic.clone(), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/builder.rs:30
} } 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
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
1,161
1,220
tokio-rs/tokio:tokio/src/runtime/builder.rs:31
); 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)) } } } imp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c84d0a14b189c45da8f5e963fd3a83790ec92f8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c84d0a14b189c45da8f5e963fd3a83790ec92f8e/tokio/src/runtime/builder.rs
1,201
1,230
tokio-rs/tokio:tokio/src/runtime/builder.rs:1
use crate::runtime::handle::Handle; use crate::runtime::{blocking, driver, Callback, 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 set the configura...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/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
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
41
100
tokio-rs/tokio:tokio/src/runtime/builder.rs:5
/// let rt = runtime::Builder::new_current_thread() /// .unhandled_panic(UnhandledPanic::ShutdownRuntime) /// .build() /// .unwrap(); /// /// rt.spawn(async { panic!("boom"); }); /// rt.spawn(async { /// // This task never completes. /// })...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
161
220
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
pub fn new_current_thread() -> Builder { #[cfg(loom)] const EVENT_INTERVAL: u32 = 4; // The number `61` is fairly arbitrary. I believe this value was copied from golang. #[cfg(not(loom))] const EVENT_INTERVAL: u32 = 61; Builder::new(Kind::CurrentThread, 31, EVENT_INTERVA...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
// 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 name thread_name: std::sync::Arc::new(|| "tokio-runtime-worker".int...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:11
/// ``` pub fn thread_name(&mut self, val: impl Into<String>) -> &mut Self { let val = val.into(); self.thread_name = std::sync::Arc::new(move || val.clone()); self } /// Sets a function used to generate the name of threads spawned by the `Runtime`'s thread pool. /// /// The...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
401
460
tokio-rs/tokio:tokio/src/runtime/builder.rs:15
/// let runtime = runtime::Builder::new_current_thread() /// .on_thread_park({ /// let barrier = barrier.clone(); /// move || { /// let barrier = barrier.clone(); /// if once.swap(false, Ordering::Relaxed) { /// tokio::spawn(async move ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
561
620
tokio-rs/tokio:tokio/src/runtime/builder.rs:16
/// # pub fn main() { /// let runtime = runtime::Builder::new_multi_thread() /// .on_thread_unpark(|| { /// println!("thread unparking"); /// }) /// .build(); /// /// runtime.unwrap().block_on(async { /// tokio::task::yield_now().await; /// println!("Hello f...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
601
660
tokio-rs/tokio:tokio/src/runtime/builder.rs:17
#[cfg(all(feature = "rt-multi-thread", not(tokio_wasi)))] Kind::MultiThread => self.build_threaded_runtime(), } } fn get_cfg(&self) -> driver::Cfg { driver::Cfg { enable_pause_time: match self.kind { Kind::CurrentThread => true, #[cfg(all(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
641
700
tokio-rs/tokio:tokio/src/runtime/builder.rs:22
pub fn disable_lifo_slot(&mut self) -> &mut Self { self.disable_lifo_slot = true; self } /// Specifies the random number generation seed to use within all /// threads associated with the runtime being built. /// /// This option is intended to make certain...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
841
900
tokio-rs/tokio:tokio/src/runtime/builder.rs:23
use crate::runtime::scheduler::{self, CurrentThread}; use crate::runtime::{runtime::Scheduler, Config}; 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 ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
881
940
tokio-rs/tokio:tokio/src/runtime/builder.rs:24
handle, blocking_pool, )) } } cfg_io_driver! { impl Builder { /// Enables the I/O driver. /// /// Doing this enables using net, process, signal, and some I/O types on /// the runtime. /// /// # Examples /// /// ``` /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
921
980
tokio-rs/tokio:tokio/src/runtime/builder.rs:25
/// .unwrap(); /// ``` pub fn max_io_events_per_tick(&mut self, capacity: usize) -> &mut Self { self.nevents = capacity; self } } } cfg_time! { impl Builder { /// Enables the time driver. /// /// Doing this enables using `tokio::time` ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
961
1,020
tokio-rs/tokio:tokio/src/runtime/builder.rs:26
/// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_current_thread() /// .enable_time() /// .start_paused(true) /// .build() /// .unwrap(); /// ``` pub fn start_paused(&mut self, start_paused: bool) ->...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/builder.rs:27
driver_handle, blocking_spawner, seed_generator_2, Config { before_park: self.before_park.clone(), after_unpark: self.after_unpark.clone(), global_queue_interval: self.global_queue_interval, e...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
682e93df93292a47e7d6d04bd9e4922c5bbae5b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/682e93df93292a47e7d6d04bd9e4922c5bbae5b4/tokio/src/runtime/builder.rs
1,041
1,083
tokio-rs/tokio:tokio/src/runtime/builder.rs:5
/// let rt = runtime::Builder::new_current_thread() /// .unhandled_panic(UnhandledPanic::ShutdownRuntime) /// .build() /// .unwrap(); /// /// rt.spawn(async { panic!("boom"); }); /// rt.spawn(async { /// // This task never completes. /// })...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/builder.rs
161
220
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
#[cfg(loom)] const EVENT_INTERVAL: u32 = 4; // The number `61` is fairly arbitrary. I believe this value was copied from golang. #[cfg(not(loom))] const EVENT_INTERVAL: u32 = 61; Builder::new(Kind::CurrentThread, 31, EVENT_INTERVAL) } cfg_not_wasi! { /// Returns...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
worker_threads: None, 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 ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:12
/// ``` /// # use tokio::runtime; /// /// # pub fn main() { /// let rt = runtime::Builder::new_multi_thread() /// .thread_stack_size(32 * 1024) /// .build(); /// # } /// ``` pub fn thread_stack_size(&mut self, val: usize) -> &mut Self { self.thread_stack_size = Some(v...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/builder.rs
441
500
tokio-rs/tokio:tokio/src/runtime/builder.rs:15
/// let barrier = barrier.clone(); /// if once.swap(false, Ordering::Relaxed) { /// tokio::spawn(async move { barrier.wait().await; }); /// } /// } /// }) /// .build() /// .unwrap(); /// /// runtime.block_on(async...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/builder.rs
561
620
tokio-rs/tokio:tokio/src/runtime/builder.rs:16
/// }) /// .build(); /// /// runtime.unwrap().block_on(async { /// tokio::task::yield_now().await; /// println!("Hello from Tokio!"); /// }) /// # } /// ``` #[cfg(not(loom))] pub fn on_thread_unpark<F>(&mut self, f: F) -> &mut Self where F: Fn() + Send +...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/builder.rs
601
660
tokio-rs/tokio:tokio/src/runtime/builder.rs:17
fn get_cfg(&self) -> driver::Cfg { driver::Cfg { enable_pause_time: match self.kind { Kind::CurrentThread => true, #[cfg(all(feature = "rt-multi-thread", not(tokio_wasi)))] Kind::MultiThread => false, }, enable_io: self.enable_i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/builder.rs
641
700
tokio-rs/tokio:tokio/src/runtime/builder.rs:22
/// Specifies the random number generation seed to use within all /// threads associated with the runtime being built. /// /// This option is intended to make certain parts of the runtime /// deterministic (e.g. the [`tokio::select!`] macro). In the case of /// [`tokio::select!`]...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/builder.rs
841
900
tokio-rs/tokio:tokio/src/runtime/builder.rs:23
// 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_generator_1 = self.seed_generator.next_generator(); let seed_generator_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/builder.rs
881
940
tokio-rs/tokio:tokio/src/runtime/builder.rs:24
} cfg_io_driver! { impl Builder { /// Enables the I/O driver. /// /// Doing this enables using net, process, signal, and some I/O types on /// the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt =...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/builder.rs
921
980
tokio-rs/tokio:tokio/src/runtime/builder.rs:25
self } } } cfg_time! { impl Builder { /// Enables the time driver. /// /// Doing this enables using `tokio::time` on the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/builder.rs
961
1,020
tokio-rs/tokio:tokio/src/runtime/builder.rs:26
/// let rt = runtime::Builder::new_current_thread() /// .enable_time() /// .start_paused(true) /// .build() /// .unwrap(); /// ``` pub fn start_paused(&mut self, start_paused: bool) -> &mut Self { self.start_paused = start_paused; s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/builder.rs
1,001
1,060
tokio-rs/tokio:tokio/src/runtime/builder.rs:27
before_park: self.before_park.clone(), after_unpark: self.after_unpark.clone(), global_queue_interval: self.global_queue_interval, event_interval: self.event_interval, #[cfg(tokio_unstable)] unhandled_panic: self.unhandl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/builder.rs
1,041
1,079
tokio-rs/tokio:tokio/src/runtime/builder.rs:1
use crate::runtime::handle::Handle; use crate::runtime::{blocking, driver, Callback, 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 set the configura...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
e14307393a3e04cc50b3a04a019b589a2d409d3f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e14307393a3e04cc50b3a04a019b589a2d409d3f/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, /// Whether or not to enable the time driver enable_time: bool, /// Whether or not the clock should start paused. start_paused: bool, /// The number of worker threads, u...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
e14307393a3e04cc50b3a04a019b589a2d409d3f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e14307393a3e04cc50b3a04a019b589a2d409d3f/tokio/src/runtime/builder.rs
41
100
tokio-rs/tokio:tokio/src/runtime/builder.rs:5
/// .unhandled_panic(UnhandledPanic::ShutdownRuntime) /// .build() /// .unwrap(); /// /// rt.spawn(async { panic!("boom"); }); /// rt.spawn(async { /// // This task never completes. /// }); /// /// rt.block_on(async { /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
e14307393a3e04cc50b3a04a019b589a2d409d3f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e14307393a3e04cc50b3a04a019b589a2d409d3f/tokio/src/runtime/builder.rs
161
220
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
const EVENT_INTERVAL: u32 = 4; // The number `61` is fairly arbitrary. I believe this value was copied from golang. #[cfg(not(loom))] const EVENT_INTERVAL: u32 = 61; Builder::new(Kind::CurrentThread, 31, EVENT_INTERVAL) } cfg_not_wasi! { /// Returns a new builder with t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
e14307393a3e04cc50b3a04a019b589a2d409d3f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e14307393a3e04cc50b3a04a019b589a2d409d3f/tokio/src/runtime/builder.rs
201
260