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:37
Ok(LocalRuntime::from_parts( LocalRuntimeScheduler::CurrentThread(scheduler), handle, blocking_pool, )) } fn build_current_thread_runtime_components( &mut self, local_tid: Option<ThreadId>, ) -> io::Result<(CurrentThread, Handle, BlockingPool)> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/tokio/src/runtime/builder.rs
1,441
1,500
tokio-rs/tokio:tokio/src/runtime/builder.rs:38
after_poll: self.after_poll.clone(), after_termination: self.after_termination.clone(), global_queue_interval: self.global_queue_interval, event_interval: self.event_interval, #[cfg(tokio_unstable)] unhandled_panic: self.unhandled_panic.clo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/tokio/src/runtime/builder.rs
1,481
1,540
tokio-rs/tokio:tokio/src/runtime/builder.rs:39
/// /// 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 configur...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/tokio/src/runtime/builder.rs
1,521
1,580
tokio-rs/tokio:tokio/src/runtime/builder.rs:40
/// ``` /// 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 ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/tokio/src/runtime/builder.rs
1,561
1,620
tokio-rs/tokio:tokio/src/runtime/builder.rs:23
/// /// 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
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/builder.rs
881
940
tokio-rs/tokio:tokio/src/runtime/builder.rs:24
match &self.kind { Kind::CurrentThread => self.build_current_thread_local_runtime(), _ => panic!("Only current_thread is supported when building a local runtime"), } } fn get_cfg(&self, workers: usize) -> driver::Cfg { driver::Cfg { enable_pause_time: match s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/builder.rs
921
980
tokio-rs/tokio:tokio/src/runtime/builder.rs:31
/// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_metrics_poll_time_histogram() /// .build() /// .unwrap(); /// # // Test default values here /// # fn us(n: u64) -> std::time::Duration { std::time::Duration::from...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/builder.rs
1,201
1,260
tokio-rs/tokio:tokio/src/runtime/builder.rs:35
/// 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; /// use std::time::Duration; /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/builder.rs
1,361
1,420
tokio-rs/tokio:tokio/src/runtime/builder.rs:36
/// # Examples /// /// ``` /// use tokio::runtime; /// /// # #[allow(deprecated)] /// let rt = runtime::Builder::new_multi_thread() /// .enable_metrics_poll_time_histogram() /// .metrics_poll_count_histogram_buckets(15) /// .build() ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/builder.rs
1,401
1,460
tokio-rs/tokio:tokio/src/runtime/builder.rs:37
Ok(LocalRuntime::from_parts( LocalRuntimeScheduler::CurrentThread(scheduler), handle, blocking_pool, )) } fn build_current_thread_runtime_components( &mut self, local_tid: Option<ThreadId>, ) -> io::Result<(CurrentThread, Handle, BlockingPool)> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/builder.rs
1,441
1,500
tokio-rs/tokio:tokio/src/runtime/builder.rs:38
#[cfg(tokio_unstable)] after_poll: self.after_poll.clone(), after_termination: self.after_termination.clone(), global_queue_interval: self.global_queue_interval, event_interval: self.event_interval, #[cfg(tokio_unstable)] un...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/builder.rs
1,481
1,540
tokio-rs/tokio:tokio/src/runtime/builder.rs:39
/// 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; self } /// Ena...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/builder.rs
1,521
1,580
tokio-rs/tokio:tokio/src/runtime/builder.rs:40
/// /// ``` /// 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
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/builder.rs
1,561
1,620
tokio-rs/tokio:tokio/src/runtime/builder.rs:41
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 worker_threads = self...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/builder.rs
1,601
1,660
tokio-rs/tokio:tokio/src/runtime/builder.rs:42
disable_lifo_slot: self.disable_lifo_slot, seed_generator: seed_generator_1, metrics_poll_count_histogram: self.metrics_poll_count_histogram_builder(), }, ); let handle = Handle { inner: scheduler::Handle::MultiThread(handle) }; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
159a3b2c8587cd12ad54eb16489dad6eb674d4ca
github
async-runtime
https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/builder.rs
1,641
1,674
tokio-rs/tokio:tokio/src/runtime/builder.rs:3
/// To run before each worker thread is parked. pub(super) before_park: Option<Callback>, /// 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 before each poll ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
81
140
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
/// rt.spawn(async { panic!("boom"); }); /// rt.spawn(async { /// // This task never completes. /// }); /// /// rt.block_on(async { /// // Do some work /// # loop { tokio::task::yield_now().await; } /// }) /// # } /// ``` //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
// 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, EVENT_INTERVAL) } /// Returns a new builder with the multi thread scheduler selected. /// /// Configuration m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:8
/// Configuration methods can be chained on the return value. pub(crate) fn new(kind: Kind, event_interval: u32) -> Builder { Builder { kind, // I/O defaults to "off" enable_io: false, nevents: 1024, // Time defaults to "off" enable_t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
281
340
tokio-rs/tokio:tokio/src/runtime/builder.rs:9
keep_alive: None, // Defaults for these values depend on the scheduler kind, so we get them // as parameters. global_queue_interval: None, event_interval, #[cfg(not(loom))] local_queue_capacity: 256, #[cfg(loom)] local_qu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
/// ``` 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 greater tha...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
521
580
tokio-rs/tokio:tokio/src/runtime/builder.rs:15
/// ``` /// # 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>(&mut s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
561
620
tokio-rs/tokio:tokio/src/runtime/builder.rs:20
where F: Fn(&TaskMeta<'_>) + Send + Sync + 'static, { self.before_spawn = Some(std::sync::Arc::new(f)); self } /// Executes function `f` just before a task is polled /// /// `f` is called within the Tokio context, so functions like /// [`tokio::spawn`](crate::spawn) can ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
761
820
tokio-rs/tokio:tokio/src/runtime/builder.rs:21
/// ``` #[cfg(tokio_unstable)] pub fn on_before_task_poll<F>(&mut self, f: F) -> &mut Self where F: Fn(&TaskMeta<'_>) + Send + Sync + 'static, { self.before_poll = Some(std::sync::Arc::new(f)); self } /// Executes function `f` just after a task is polled /// /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
801
860
tokio-rs/tokio:tokio/src/runtime/builder.rs:22
/// let _ = rt.block_on(task); /// /// # } /// ``` #[cfg(tokio_unstable)] pub fn on_after_task_poll<F>(&mut self, f: F) -> &mut Self where F: Fn(&TaskMeta<'_>) + Send + Sync + 'static, { self.after_poll = Some(std::sync::Arc::new(f)); self } /// Executes func...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
841
900
tokio-rs/tokio:tokio/src/runtime/builder.rs:23
/// .build() /// .unwrap(); /// /// runtime.block_on(async { /// tokio::task::spawn(std::future::ready(())); /// /// for _ in 0..64 { /// tokio::task::yield_now().await; /// } /// }) /// # } /// ``` #[cfg(all(not(loom), tokio_unstable))] #[...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
881
940
tokio-rs/tokio:tokio/src/runtime/builder.rs:24
#[cfg(feature = "rt-multi-thread")] Kind::MultiThread => self.build_threaded_runtime(), #[cfg(all(tokio_unstable, feature = "rt-multi-thread"))] Kind::MultiThreadAlt => self.build_alt_threaded_runtime(), } } /// Creates the configured `LocalRuntime`. /// /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
921
980
tokio-rs/tokio:tokio/src/runtime/builder.rs:25
enable_pause_time: match self.kind { Kind::CurrentThread => true, #[cfg(feature = "rt-multi-thread")] Kind::MultiThread => false, #[cfg(all(tokio_unstable, feature = "rt-multi-thread"))] Kind::MultiThreadAlt => false, }, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
961
1,020
tokio-rs/tokio:tokio/src/runtime/builder.rs:32
/// # // Test default values here /// # fn us(n: u64) -> std::time::Duration { std::time::Duration::from_micros(n) } /// # let m = rt.handle().metrics(); /// # assert_eq!(m.poll_time_histogram_num_buckets(), 10); /// # assert_eq!(m.poll_time_histogram_bucket_range(0), us(0)..us(100)); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
1,241
1,300
tokio-rs/tokio:tokio/src/runtime/builder.rs:36
/// /// ``` /// use tokio::runtime; /// use std::time::Duration; /// /// # #[allow(deprecated)] /// let rt = runtime::Builder::new_multi_thread() /// .enable_metrics_poll_time_histogram() /// .metrics_poll_count_histogram_resolution(Duration::from_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
1,401
1,460
tokio-rs/tokio:tokio/src/runtime/builder.rs:37
/// let rt = runtime::Builder::new_multi_thread() /// .enable_metrics_poll_time_histogram() /// .metrics_poll_count_histogram_buckets(15) /// .build() /// .unwrap(); /// ``` #[deprecated(note = "use `metrics_poll_time_histogram_configuration`")] pu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
1,441
1,500
tokio-rs/tokio:tokio/src/runtime/builder.rs:38
let (scheduler, handle, blocking_pool) = self.build_current_thread_runtime_components(Some(tid))?; Ok(LocalRuntime::from_parts( LocalRuntimeScheduler::CurrentThread(scheduler), handle, blocking_pool, )) } fn build_current_thread_runtime_component...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
1,481
1,540
tokio-rs/tokio:tokio/src/runtime/builder.rs:39
#[cfg(tokio_unstable)] before_poll: self.before_poll.clone(), #[cfg(tokio_unstable)] after_poll: self.after_poll.clone(), after_termination: self.after_termination.clone(), global_queue_interval: self.global_queue_interval, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
1,521
1,580
tokio-rs/tokio:tokio/src/runtime/builder.rs:40
/// # Examples /// /// ``` /// 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 ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
1,561
1,620
tokio-rs/tokio:tokio/src/runtime/builder.rs:41
/// 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
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
1,601
1,660
tokio-rs/tokio:tokio/src/runtime/builder.rs:42
} } } 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 worker_thr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
1,641
1,700
tokio-rs/tokio:tokio/src/runtime/builder.rs:43
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_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
1,681
1,740
tokio-rs/tokio:tokio/src/runtime/builder.rs:44
driver_handle, blocking_spawner, seed_generator_2, Config { before_park: self.before_park.clone(), after_unpark: self.after_unpark.clone(), before_spawn: self.before_spawn.clone(), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
ce87dcfbf08dc5330386433c1e62229a3c4d5571
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce87dcfbf08dc5330386433c1e62229a3c4d5571/tokio/src/runtime/builder.rs
1,721
1,766
tokio-rs/tokio:tokio/src/runtime/builder.rs:15
/// ``` #[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 } /// Executes function `f` before each thread stops. /// /// This is intended for boo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
20c1fdc678a7b9947b1d12d53619c90291f995d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20c1fdc678a7b9947b1d12d53619c90291f995d2/tokio/src/runtime/builder.rs
561
620
tokio-rs/tokio:tokio/src/runtime/builder.rs:23
/// }) /// # } /// ``` #[cfg(all(not(loom), tokio_unstable))] #[cfg_attr(docsrs, doc(cfg(tokio_unstable)))] pub fn on_task_terminate<F>(&mut self, f: F) -> &mut Self where F: Fn(&TaskMeta<'_>) + Send + Sync + 'static, { self.after_termination = Some(std::sync::Arc::new(f)); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
20c1fdc678a7b9947b1d12d53619c90291f995d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20c1fdc678a7b9947b1d12d53619c90291f995d2/tokio/src/runtime/builder.rs
881
940
tokio-rs/tokio:tokio/src/runtime/builder.rs:24
/// The returned `LocalRuntime` instance is ready to spawn tasks. /// /// # Panics /// This will panic if `current_thread` is not the selected runtime flavor. /// All other runtime flavors are unsupported by [`LocalRuntime`]. /// /// [`LocalRuntime`]: [crate::runtime::LocalRuntime] /// /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
20c1fdc678a7b9947b1d12d53619c90291f995d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20c1fdc678a7b9947b1d12d53619c90291f995d2/tokio/src/runtime/builder.rs
921
980
tokio-rs/tokio:tokio/src/runtime/builder.rs:32
/// [`Instant::now()`]: std::time::Instant::now /// [`LogHistogram`]: crate::runtime::LogHistogram /// [`metrics_poll_time_histogram_configuration()`]: Builder::metrics_poll_time_histogram_configuration pub fn enable_metrics_poll_time_histogram(&mut self) -> &mut Self { self.metrics_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
20c1fdc678a7b9947b1d12d53619c90291f995d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20c1fdc678a7b9947b1d12d53619c90291f995d2/tokio/src/runtime/builder.rs
1,241
1,300
tokio-rs/tokio:tokio/src/runtime/builder.rs:36
/// .build() /// .unwrap(); /// ``` #[deprecated(note = "use `metrics_poll_time_histogram_configuration`")] pub fn metrics_poll_count_histogram_resolution(&mut self, resolution: Duration) -> &mut Self { assert!(resolution > Duration::from_secs(0)); // Sani...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
20c1fdc678a7b9947b1d12d53619c90291f995d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20c1fdc678a7b9947b1d12d53619c90291f995d2/tokio/src/runtime/builder.rs
1,401
1,460
tokio-rs/tokio:tokio/src/runtime/builder.rs:37
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 } } fn build_current_thread_runtime(&mut self) -> io::Result<Runtime> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
20c1fdc678a7b9947b1d12d53619c90291f995d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20c1fdc678a7b9947b1d12d53619c90291f995d2/tokio/src/runtime/builder.rs
1,441
1,500
tokio-rs/tokio:tokio/src/runtime/builder.rs:38
fn build_current_thread_runtime_components( &mut self, local_tid: Option<ThreadId>, ) -> io::Result<(CurrentThread, Handle, BlockingPool)> { use crate::runtime::scheduler; use crate::runtime::Config; let (driver, driver_handle) = driver::Driver::new(self.get_cfg(1))?; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
20c1fdc678a7b9947b1d12d53619c90291f995d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20c1fdc678a7b9947b1d12d53619c90291f995d2/tokio/src/runtime/builder.rs
1,481
1,540
tokio-rs/tokio:tokio/src/runtime/builder.rs:39
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(), }, local_tid, ); let handle = Ha...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
20c1fdc678a7b9947b1d12d53619c90291f995d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20c1fdc678a7b9947b1d12d53619c90291f995d2/tokio/src/runtime/builder.rs
1,521
1,580
tokio-rs/tokio:tokio/src/runtime/builder.rs:40
/// ``` pub fn enable_io(&mut self) -> &mut Self { 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:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
20c1fdc678a7b9947b1d12d53619c90291f995d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20c1fdc678a7b9947b1d12d53619c90291f995d2/tokio/src/runtime/builder.rs
1,561
1,620
tokio-rs/tokio:tokio/src/runtime/builder.rs:41
/// .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
20c1fdc678a7b9947b1d12d53619c90291f995d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20c1fdc678a7b9947b1d12d53619c90291f995d2/tokio/src/runtime/builder.rs
1,601
1,660
tokio-rs/tokio:tokio/src/runtime/builder.rs:42
use crate::runtime::scheduler::{self, MultiThread}; let worker_threads = self.worker_threads.unwrap_or_else(num_cpus); let (driver, driver_handle) = driver::Driver::new(self.get_cfg(worker_threads))?; // Create the blocking pool let blocking_pool = bloc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
20c1fdc678a7b9947b1d12d53619c90291f995d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20c1fdc678a7b9947b1d12d53619c90291f995d2/tokio/src/runtime/builder.rs
1,641
1,700
tokio-rs/tokio:tokio/src/runtime/builder.rs:43
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
20c1fdc678a7b9947b1d12d53619c90291f995d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20c1fdc678a7b9947b1d12d53619c90291f995d2/tokio/src/runtime/builder.rs
1,681
1,740
tokio-rs/tokio:tokio/src/runtime/builder.rs:44
before_poll: self.before_poll.clone(), #[cfg(tokio_unstable)] after_poll: self.after_poll.clone(), global_queue_interval: self.global_queue_interval, event_interval: self.event_interval, local_queue_c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
20c1fdc678a7b9947b1d12d53619c90291f995d2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20c1fdc678a7b9947b1d12d53619c90291f995d2/tokio/src/runtime/builder.rs
1,721
1,757
tokio-rs/tokio:tokio/src/runtime/builder.rs:41
/// .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
b8ac94ed70df22f885bad7ea3c0ff51c536bad4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/builder.rs
1,601
1,660
tokio-rs/tokio:tokio/src/runtime/builder.rs:42
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(core_threads))?; // Create the blocking pool let blocking_pool = blocking...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
b8ac94ed70df22f885bad7ea3c0ff51c536bad4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/builder.rs
1,641
1,700
tokio-rs/tokio:tokio/src/runtime/builder.rs:43
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
b8ac94ed70df22f885bad7ea3c0ff51c536bad4a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b8ac94ed70df22f885bad7ea3c0ff51c536bad4a/tokio/src/runtime/builder.rs
1,681
1,740
tokio-rs/tokio:tokio/src/runtime/builder.rs:2
/// .thread_stack_size(3 * 1024 * 1024) /// .build() /// .unwrap(); /// /// // 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 t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
41
100
tokio-rs/tokio:tokio/src/runtime/builder.rs:3
/// To run before each worker thread is parked. pub(super) before_park: Option<Callback>, /// 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 t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
81
140
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 =...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
/// /// Configuration methods can be chained on the return value. #[cfg(feature = "rt-multi-thread")] #[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. Bui...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:8
// 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
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
281
340
tokio-rs/tokio:tokio/src/runtime/builder.rs:9
seed_generator: RngSeedGenerator::new(RngSeed::new()), #[cfg(tokio_unstable)] unhandled_panic: UnhandledPanic::Ignore, metrics_poll_count_histogram_enable: false, metrics_poll_count_histogram: HistogramBuilder::default(), disable_lifo_slot: false, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:14
/// # 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(val); self } /// Executes function...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/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 + S...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
641
700
tokio-rs/tokio:tokio/src/runtime/builder.rs:20
/// /// [unstable]: crate#unstable-features /// /// # Examples /// /// ``` /// # use tokio::runtime; /// # pub fn main() { /// let runtime = runtime::Builder::new_current_thread() /// .on_task_terminate(|_| { /// println!("killing task"); /// }) /// .b...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
761
820
tokio-rs/tokio:tokio/src/runtime/builder.rs:21
/// ``` /// use tokio::runtime::Builder; /// /// 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 { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
801
860
tokio-rs/tokio:tokio/src/runtime/builder.rs:22
#[allow(unused_variables, unreachable_patterns)] #[cfg(tokio_unstable)] #[cfg_attr(docsrs, doc(cfg(tokio_unstable)))] pub fn build_local(&mut self, options: &LocalOptions) -> io::Result<LocalRuntime> { match &self.kind { Kind::CurrentThread => self.build_current_thread_local_runtime(), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
841
900
tokio-rs/tokio:tokio/src/runtime/builder.rs:34
/// 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 /// /// # Examples /// /// ``` /// use ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
1,321
1,380
tokio-rs/tokio:tokio/src/runtime/builder.rs:35
Scheduler::CurrentThread(scheduler), handle, blocking_pool, )) } #[cfg(tokio_unstable)] fn build_current_thread_local_runtime(&mut self) -> io::Result<LocalRuntime> { use crate::runtime::local_runtime::LocalRuntimeScheduler; let tid = std::thread::current()....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
1,361
1,420
tokio-rs/tokio:tokio/src/runtime/builder.rs:36
// there are no futures ready to do something, it'll let the timer or // the reactor to generate some new stimuli for the futures to continue // in their life. let (scheduler, handle) = CurrentThread::new( driver, driver_handle, blocking_spawner, s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
1,401
1,460
tokio-rs/tokio:tokio/src/runtime/builder.rs:37
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 = ru...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
1,441
1,500
tokio-rs/tokio:tokio/src/runtime/builder.rs:38
} } } 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
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
1,481
1,540
tokio-rs/tokio:tokio/src/runtime/builder.rs:39
/// .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
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
1,521
1,580
tokio-rs/tokio:tokio/src/runtime/builder.rs:40
after_unpark: self.after_unpark.clone(), before_spawn: self.before_spawn.clone(), after_termination: self.after_termination.clone(), global_queue_interval: self.global_queue_interval, event_interval: self.event_interval, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
1,561
1,620
tokio-rs/tokio:tokio/src/runtime/builder.rs:41
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
15495fd88305099d4ffa0a5583f6d8856d728ac3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/15495fd88305099d4ffa0a5583f6d8856d728ac3/tokio/src/runtime/builder.rs
1,601
1,646
tokio-rs/tokio:tokio/src/runtime/builder.rs:33
/// ``` #[deprecated(note = "use `metrics_poll_time_histogram_configuration`")] 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 s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c032ea02030b55ef3b16000cd3f51d19009469da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c032ea02030b55ef3b16000cd3f51d19009469da/tokio/src/runtime/builder.rs
1,281
1,340
tokio-rs/tokio:tokio/src/runtime/builder.rs:34
} 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 crate::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c032ea02030b55ef3b16000cd3f51d19009469da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c032ea02030b55ef3b16000cd3f51d19009469da/tokio/src/runtime/builder.rs
1,321
1,380
tokio-rs/tokio:tokio/src/runtime/builder.rs:35
&mut self, local_tid: Option<ThreadId>, ) -> io::Result<(CurrentThread, Handle, BlockingPool)> { use crate::runtime::scheduler; use crate::runtime::Config; let (driver, driver_handle) = driver::Driver::new(self.get_cfg(1))?; // Blocking pool let blocking_pool = bloc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c032ea02030b55ef3b16000cd3f51d19009469da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c032ea02030b55ef3b16000cd3f51d19009469da/tokio/src/runtime/builder.rs
1,361
1,420
tokio-rs/tokio:tokio/src/runtime/builder.rs:36
); let handle = Handle { inner: scheduler::Handle::CurrentThread(handle), }; Ok((scheduler, handle, blocking_pool)) } fn metrics_poll_count_histogram_builder(&self) -> Option<HistogramBuilder> { if self.metrics_poll_count_histogram_enable { Some(self.me...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c032ea02030b55ef3b16000cd3f51d19009469da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c032ea02030b55ef3b16000cd3f51d19009469da/tokio/src/runtime/builder.rs
1,401
1,460
tokio-rs/tokio:tokio/src/runtime/builder.rs:37
/// 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_current_thread() /// .enable_io() /// .ma...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c032ea02030b55ef3b16000cd3f51d19009469da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c032ea02030b55ef3b16000cd3f51d19009469da/tokio/src/runtime/builder.rs
1,441
1,500
tokio-rs/tokio:tokio/src/runtime/builder.rs:38
} } } 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 /// /// ``` ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c032ea02030b55ef3b16000cd3f51d19009469da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c032ea02030b55ef3b16000cd3f51d19009469da/tokio/src/runtime/builder.rs
1,481
1,540
tokio-rs/tokio:tokio/src/runtime/builder.rs:39
// Create the blocking pool let blocking_pool = blocking::create_blocking_pool(self, self.max_blocking_threads + core_threads); let blocking_spawner = blocking_pool.spawner().clone(); // Generate a rng seed for this runtime. let seed_generator_1 = self.se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c032ea02030b55ef3b16000cd3f51d19009469da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c032ea02030b55ef3b16000cd3f51d19009469da/tokio/src/runtime/builder.rs
1,521
1,580
tokio-rs/tokio:tokio/src/runtime/builder.rs:40
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 = self.worker_t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c032ea02030b55ef3b16000cd3f51d19009469da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c032ea02030b55ef3b16000cd3f51d19009469da/tokio/src/runtime/builder.rs
1,561
1,620
tokio-rs/tokio:tokio/src/runtime/builder.rs:41
Ok(Runtime::from_parts(Scheduler::MultiThreadAlt(scheduler), handle, blocking_pool)) } } } } impl fmt::Debug for Builder { fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("Builder") .field("worker_threads", &self.worker_threads) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c032ea02030b55ef3b16000cd3f51d19009469da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c032ea02030b55ef3b16000cd3f51d19009469da/tokio/src/runtime/builder.rs
1,601
1,623
tokio-rs/tokio:tokio/src/runtime/builder.rs:18
/// 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 + Sync + 'static, { self.after_unp...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/tokio/src/runtime/builder.rs
681
740
tokio-rs/tokio:tokio/src/runtime/builder.rs:19
/// runtime.block_on(async { /// 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_spawn<F>(&mut self, f: F) -> &mut Self ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/tokio/src/runtime/builder.rs
721
780
tokio-rs/tokio:tokio/src/runtime/builder.rs:20
/// .unwrap(); /// /// runtime.block_on(async { /// 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_terminat...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/tokio/src/runtime/builder.rs
761
820
tokio-rs/tokio:tokio/src/runtime/builder.rs:21
#[cfg(all(tokio_unstable, feature = "rt-multi-thread"))] Kind::MultiThreadAlt => self.build_alt_threaded_runtime(), } } /// Creates the configured `LocalRuntime`. /// /// The returned `LocalRuntime` instance is ready to spawn tasks. /// /// # Panics /// This will panic i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/tokio/src/runtime/builder.rs
801
860
tokio-rs/tokio:tokio/src/runtime/builder.rs:22
#[cfg(feature = "rt-multi-thread")] Kind::MultiThread => false, #[cfg(all(tokio_unstable, feature = "rt-multi-thread"))] Kind::MultiThreadAlt => false, }, enable_io: self.enable_io, enable_time: self.enable_time, start_pause...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/tokio/src/runtime/builder.rs
841
900
tokio-rs/tokio:tokio/src/runtime/builder.rs:29
/// # let m = rt.handle().metrics(); /// # assert_eq!(m.poll_time_histogram_num_buckets(), 10); /// # assert_eq!(m.poll_time_histogram_bucket_range(0), us(0)..us(100)); /// # assert_eq!(m.poll_time_histogram_bucket_range(1), us(100)..us(200)); /// ``` /// /// [`Handle::me...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/tokio/src/runtime/builder.rs
1,121
1,180
tokio-rs/tokio:tokio/src/runtime/builder.rs:33
/// 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 buckets, the 10th bucket will track task /// polls that take more than 450m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/tokio/src/runtime/builder.rs
1,281
1,340
tokio-rs/tokio:tokio/src/runtime/builder.rs:34
self.build_current_thread_runtime_components(None)?; Ok(Runtime::from_parts( Scheduler::CurrentThread(scheduler), handle, blocking_pool, )) } #[cfg(tokio_unstable)] fn build_current_thread_local_runtime(&mut self) -> io::Result<LocalRuntime> { us...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/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(); // And now put a single-threaded scheduler on top of the timer. When // there are no futures ready to do something, it'll let the timer or // the reactor to generate some new stimuli for the futures to continue // in their lif...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/tokio/src/runtime/builder.rs
1,361
1,420
tokio-rs/tokio:tokio/src/runtime/builder.rs:36
} } } 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; /// /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/tokio/src/runtime/builder.rs
1,401
1,460
tokio-rs/tokio:tokio/src/runtime/builder.rs:37
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` on the runtime. /// /// # E...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/tokio/src/runtime/builder.rs
1,441
1,500
tokio-rs/tokio:tokio/src/runtime/builder.rs:38
/// 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) -> &mut Self { sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/tokio/src/runtime/builder.rs
1,481
1,540
tokio-rs/tokio:tokio/src/runtime/builder.rs:39
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(), globa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/tokio/src/runtime/builder.rs
1,521
1,580
tokio-rs/tokio:tokio/src/runtime/builder.rs:40
// 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) = MultiThreadAlt::new( core_threads, driver,...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
fbfeb9a68a22556935b64dc426601b799ec369ac
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fbfeb9a68a22556935b64dc426601b799ec369ac/tokio/src/runtime/builder.rs
1,561
1,609
tokio-rs/tokio:tokio/src/runtime/builder.rs:32
/// 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; /// use std::time::Duration; /// ...
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,241
1,300
tokio-rs/tokio:tokio/src/runtime/builder.rs:33
/// # Examples /// /// ``` /// use tokio::runtime; /// /// # #[allow(deprecated)] /// let rt = runtime::Builder::new_multi_thread() /// .enable_metrics_poll_count_histogram() /// .metrics_poll_count_histogram_buckets(15) /// .build() ...
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,281
1,340
tokio-rs/tokio:tokio/src/runtime/builder.rs:34
#[cfg(tokio_unstable)] 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_comp...
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,321
1,380
tokio-rs/tokio:tokio/src/runtime/builder.rs:35
blocking_spawner, 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,361
1,420