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/blocking/pool.rs:6
if shared.shutdown { // Shutdown the task task.shutdown(); // no need to even push this task; it would never get picked up return; } shared.queue.push_back(task); if shared.num_idle == 0 { // No thread...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
3d1b4b30585532e9708e322e1a0876d2933af71a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3d1b4b30585532e9708e322e1a0876d2933af71a/tokio/src/runtime/blocking/pool.rs
201
260
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:7
let mut builder = thread::Builder::new().name(self.inner.thread_name.clone()); if let Some(stack_size) = self.inner.stack_size { builder = builder.stack_size(stack_size); } let spawner = self.clone(); builder .spawn(move || { run_thread(spawner)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
3d1b4b30585532e9708e322e1a0876d2933af71a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3d1b4b30585532e9708e322e1a0876d2933af71a/tokio/src/runtime/blocking/pool.rs
241
300
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:6
if shared.shutdown { // Shutdown the task task.shutdown(); // no need to even push this task; it would never get picked up return; } shared.queue.push_back(task); if shared.num_idle == 0 { // No thread...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
8656b7b8eb6f3635ec40694eb71f14fb84211e05
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/runtime/blocking/pool.rs
201
260
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:7
let mut builder = thread::Builder::new().name(self.inner.thread_name.clone()); if let Some(stack_size) = self.inner.stack_size { builder = builder.stack_size(stack_size); } let inner = self.inner.clone(); builder .spawn(move || { inner.run(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
8656b7b8eb6f3635ec40694eb71f14fb84211e05
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/runtime/blocking/pool.rs
241
300
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:8
while let Some(task) = shared.queue.pop_front() { drop(shared); run_task(task); shared = self.shared.lock().unwrap(); if shared.shutdown { break; // Need to increment idle before we exit } } // ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
8656b7b8eb6f3635ec40694eb71f14fb84211e05
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/runtime/blocking/pool.rs
281
340
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:9
task.shutdown(); shared = self.shared.lock().unwrap(); } // Work was produced, and we "took" it (by decrementing num_notify). // This means that num_idle was decremented once for our wakeup. // But, since we are exiting, we need to "u...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
8656b7b8eb6f3635ec40694eb71f14fb84211e05
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8656b7b8eb6f3635ec40694eb71f14fb84211e05/tokio/src/runtime/blocking/pool.rs
321
369
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:1
//! Thread pool for blocking operations use crate::loom::sync::{Arc, Condvar, Mutex}; use crate::loom::thread; use crate::runtime::{self, io, time, Builder, Callback}; use crate::runtime::blocking::shutdown; use crate::runtime::blocking::schedule::NoopSchedule; use crate::runtime::blocking::task::BlockingTask; use cra...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
b24ad9fe861ce01add2c6533149f643e38537f59
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b24ad9fe861ce01add2c6533149f643e38537f59/tokio/src/runtime/blocking/pool.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:2
/// Call before a thread stops before_stop: Option<Callback>, /// Spawns async tasks spawner: runtime::Spawner, /// Runtime I/O driver handle io_handle: io::Handle, /// Runtime time driver handle time_handle: time::Handle, /// Source of `Instant::now()` clock: time::Clock, t...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
b24ad9fe861ce01add2c6533149f643e38537f59
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b24ad9fe861ce01add2c6533149f643e38537f59/tokio/src/runtime/blocking/pool.rs
41
100
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:3
where F: FnOnce() -> R + Send + 'static, { BLOCKING.with(|cell| { let schedule = match cell.get() { Some(ptr) => unsafe { &*ptr }, None => panic!("not currently running on the Tokio runtime."), }; let (task, handle) = task::joinable(BlockingTask::new(func)); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
b24ad9fe861ce01add2c6533149f643e38537f59
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b24ad9fe861ce01add2c6533149f643e38537f59/tokio/src/runtime/blocking/pool.rs
81
140
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:4
thread_name: builder.thread_name.clone(), stack_size: builder.thread_stack_size, after_start: builder.after_start.clone(), before_stop: builder.before_stop.clone(), spawner: spawner.clone(), io_handle: io.clone(), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
b24ad9fe861ce01add2c6533149f643e38537f59
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b24ad9fe861ce01add2c6533149f643e38537f59/tokio/src/runtime/blocking/pool.rs
121
180
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:5
// ===== impl Spawner ===== impl Spawner { /// Set the blocking pool for the duration of the closure /// /// If a blocking pool is already set, it will be restored when the closure /// returns or if it panics. pub(crate) fn enter<F, R>(&self, f: F) -> R where F: FnOnce() -> R, { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
b24ad9fe861ce01add2c6533149f643e38537f59
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b24ad9fe861ce01add2c6533149f643e38537f59/tokio/src/runtime/blocking/pool.rs
161
220
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:6
if shared.shutdown { // Shutdown the task task.shutdown(); // no need to even push this task; it would never get picked up return; } shared.queue.push_back(task); if shared.num_idle == 0 { // No thread...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
b24ad9fe861ce01add2c6533149f643e38537f59
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b24ad9fe861ce01add2c6533149f643e38537f59/tokio/src/runtime/blocking/pool.rs
201
260
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:7
fn spawn_thread(&self, shutdown_tx: shutdown::Sender) { let mut builder = thread::Builder::new().name(self.inner.thread_name.clone()); if let Some(stack_size) = self.inner.stack_size { builder = builder.stack_size(stack_size); } let inner = self.inner.clone(); buil...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
b24ad9fe861ce01add2c6533149f643e38537f59
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b24ad9fe861ce01add2c6533149f643e38537f59/tokio/src/runtime/blocking/pool.rs
241
300
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:8
// BUSY while let Some(task) = shared.queue.pop_front() { drop(shared); run_task(task); shared = self.shared.lock().unwrap(); if shared.shutdown { break; // Need to increment idle before we exit } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
b24ad9fe861ce01add2c6533149f643e38537f59
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b24ad9fe861ce01add2c6533149f643e38537f59/tokio/src/runtime/blocking/pool.rs
281
340
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:9
drop(shared); task.shutdown(); shared = self.shared.lock().unwrap(); } // Work was produced, and we "took" it (by decrementing num_notify). // This means that num_idle was decremented once for our wakeup. // But, s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
b24ad9fe861ce01add2c6533149f643e38537f59
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b24ad9fe861ce01add2c6533149f643e38537f59/tokio/src/runtime/blocking/pool.rs
321
370
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:10
fn fmt(&self, fmt: &mut fmt::Formatter<'_>) -> fmt::Result { fmt.debug_struct("blocking::Spawner").finish() } } fn run_task(f: Task) { let scheduler: &'static NoopSchedule = &NoopSchedule; let res = f.run(|| Some(scheduler.into())); assert!(res.is_none()); }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
b24ad9fe861ce01add2c6533149f643e38537f59
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b24ad9fe861ce01add2c6533149f643e38537f59/tokio/src/runtime/blocking/pool.rs
361
370
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:1
//! Thread pool for blocking operations use crate::loom::sync::{Arc, Condvar, Mutex}; use crate::loom::thread; use crate::runtime::{self, io, time, Builder, Callback}; use crate::runtime::blocking::shutdown; use crate::runtime::blocking::schedule::NoopSchedule; use crate::runtime::blocking::task::BlockingTask; use cra...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
83cd754bc80dc8718b65fd32f54e53b4d7ba8332
github
async-runtime
https://github.com/tokio-rs/tokio/blob/83cd754bc80dc8718b65fd32f54e53b4d7ba8332/tokio/src/runtime/blocking/pool.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:2
/// Call before a thread stops before_stop: Option<Callback>, /// Spawns async tasks spawner: runtime::Spawner, /// Runtime I/O driver handle io_handle: io::Handle, /// Runtime time driver handle time_handle: time::Handle, /// Source of `Instant::now()` clock: time::Clock, } st...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
83cd754bc80dc8718b65fd32f54e53b4d7ba8332
github
async-runtime
https://github.com/tokio-rs/tokio/blob/83cd754bc80dc8718b65fd32f54e53b4d7ba8332/tokio/src/runtime/blocking/pool.rs
41
100
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:3
F: FnOnce() -> R + Send + 'static, { BLOCKING.with(|cell| { let schedule = match cell.get() { Some(ptr) => unsafe { &*ptr }, None => panic!("not currently running on the Tokio runtime."), }; let (task, handle) = task::joinable(BlockingTask::new(func)); schedu...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
83cd754bc80dc8718b65fd32f54e53b4d7ba8332
github
async-runtime
https://github.com/tokio-rs/tokio/blob/83cd754bc80dc8718b65fd32f54e53b4d7ba8332/tokio/src/runtime/blocking/pool.rs
81
140
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:4
after_start: builder.after_start.clone(), before_stop: builder.before_stop.clone(), spawner: spawner.clone(), io_handle: io.clone(), time_handle: time.clone(), clock: clock.clone(), }), }, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
83cd754bc80dc8718b65fd32f54e53b4d7ba8332
github
async-runtime
https://github.com/tokio-rs/tokio/blob/83cd754bc80dc8718b65fd32f54e53b4d7ba8332/tokio/src/runtime/blocking/pool.rs
121
180
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:5
/// Set the blocking pool for the duration of the closure /// /// If a blocking pool is already set, it will be restored when the closure /// returns or if it panics. pub(crate) fn enter<F, R>(&self, f: F) -> R where F: FnOnce() -> R, { // While scary, this is safe. The function ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
83cd754bc80dc8718b65fd32f54e53b4d7ba8332
github
async-runtime
https://github.com/tokio-rs/tokio/blob/83cd754bc80dc8718b65fd32f54e53b4d7ba8332/tokio/src/runtime/blocking/pool.rs
161
220
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:6
task.shutdown(); // no need to even push this task; it would never get picked up return; } shared.queue.push_back(task); if shared.num_idle == 0 { // No threads are able to process the task. if shared.num_th == MAX_T...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
83cd754bc80dc8718b65fd32f54e53b4d7ba8332
github
async-runtime
https://github.com/tokio-rs/tokio/blob/83cd754bc80dc8718b65fd32f54e53b4d7ba8332/tokio/src/runtime/blocking/pool.rs
201
260
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:7
if let Some(stack_size) = self.inner.stack_size { builder = builder.stack_size(stack_size); } let inner = self.inner.clone(); builder .spawn(move || { inner.run(); // Make sure `inner` drops first to ensure that the shutdown_rx ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
83cd754bc80dc8718b65fd32f54e53b4d7ba8332
github
async-runtime
https://github.com/tokio-rs/tokio/blob/83cd754bc80dc8718b65fd32f54e53b4d7ba8332/tokio/src/runtime/blocking/pool.rs
241
300
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:8
run_task(task); shared = self.shared.lock().unwrap(); if shared.shutdown { break; // Need to increment idle before we exit } } // IDLE shared.num_idle += 1; while !shared.shutdown { let...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
83cd754bc80dc8718b65fd32f54e53b4d7ba8332
github
async-runtime
https://github.com/tokio-rs/tokio/blob/83cd754bc80dc8718b65fd32f54e53b4d7ba8332/tokio/src/runtime/blocking/pool.rs
281
340
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:8
run_task(task); shared = self.shared.lock().unwrap(); if shared.shutdown { break; // Need to increment idle before we exit } } // IDLE shared.num_idle += 1; while !shared.shutdown { let...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
a8a4a9f0fceb33162bfb34160ac8ceb098c65ee3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a8a4a9f0fceb33162bfb34160ac8ceb098c65ee3/tokio/src/runtime/blocking/pool.rs
281
340
tokio-rs/tokio:tokio/src/runtime/blocking/pool.rs:9
} } // Thread exit shared.num_th -= 1; // num_idle should now be tracked exactly, panic // with a descriptive message if it is not the // case. shared.num_idle = shared .num_idle .checked_sub(1) .expect("num_idle underflowed o...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/pool.rs
MIT
a8a4a9f0fceb33162bfb34160ac8ceb098c65ee3
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a8a4a9f0fceb33162bfb34160ac8ceb098c65ee3/tokio/src/runtime/blocking/pool.rs
321
357
tokio-rs/tokio:tokio/src/runtime/blocking/schedule.rs:1
#[cfg(feature = "test-util")] use crate::runtime::scheduler; use crate::runtime::task::{self, Task, TaskHarnessScheduleHooks}; use crate::runtime::Handle; /// `task::Schedule` implementation that does nothing (except some bookkeeping /// in test-util builds). This is unique to the blocking scheduler as tasks /// sched...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/schedule.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/blocking/schedule.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/schedule.rs:2
impl task::Schedule for BlockingSchedule { fn release(&self, _task: &Task<Self>) -> Option<Task<Self>> { #[cfg(feature = "test-util")] { match &self.handle.inner { scheduler::Handle::CurrentThread(handle) => { handle.driver.clock.allow_auto_advance(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/schedule.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/blocking/schedule.rs
41
66
tokio-rs/tokio:tokio/src/runtime/blocking/schedule.rs:1
#[cfg(feature = "test-util")] use crate::runtime::scheduler; use crate::runtime::task::{self, Task, TaskHarnessScheduleHooks}; use crate::runtime::Handle; /// `task::Schedule` implementation that does nothing (except some bookkeeping /// in test-util builds). This is unique to the blocking scheduler as tasks /// sched...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/schedule.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/blocking/schedule.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/schedule.rs:2
} impl task::Schedule for BlockingSchedule { fn release(&self, _task: &Task<Self>) -> Option<Task<Self>> { #[cfg(feature = "test-util")] { match &self.handle.inner { scheduler::Handle::CurrentThread(handle) => { handle.driver.clock.allow_auto_advance(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/schedule.rs
MIT
b37f0de28a17ced6a9e6738062770d6fea8c5364
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b37f0de28a17ced6a9e6738062770d6fea8c5364/tokio/src/runtime/blocking/schedule.rs
41
70
tokio-rs/tokio:tokio/src/runtime/blocking/schedule.rs:1
#[cfg(feature = "test-util")] use crate::runtime::scheduler; use crate::runtime::task::{self, Task}; use crate::runtime::Handle; /// `task::Schedule` implementation that does nothing (except some bookkeeping /// in test-util builds). This is unique to the blocking scheduler as tasks /// scheduled are not really future...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/schedule.rs
MIT
9ed595767d01c400955122d276b34ab52b3a6aab
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9ed595767d01c400955122d276b34ab52b3a6aab/tokio/src/runtime/blocking/schedule.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/schedule.rs:1
#[cfg(feature = "test-util")] use crate::runtime::scheduler; use crate::runtime::task::{self, Task}; use crate::runtime::Handle; /// `task::Schedule` implementation that does nothing (except some bookkeeping /// in test-util builds). This is unique to the blocking scheduler as tasks /// scheduled are not really future...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/schedule.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/blocking/schedule.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/schedule.rs:1
#[cfg(feature = "test-util")] use crate::runtime::scheduler; use crate::runtime::task::{self, Task}; use crate::runtime::Handle; /// `task::Schedule` implementation that does nothing (except some bookkeeping /// in test-util builds). This is unique to the blocking scheduler as tasks /// scheduled are not really future...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/schedule.rs
MIT
4165601b1bbaa7c29cbfb319fe75a9adddf4085e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/4165601b1bbaa7c29cbfb319fe75a9adddf4085e/tokio/src/runtime/blocking/schedule.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/schedule.rs:1
#[cfg(feature = "test-util")] use crate::runtime::scheduler; use crate::runtime::task::{self, Task}; use crate::runtime::Handle; /// `task::Schedule` implementation that does nothing (except some bookkeeping /// in test-util builds). This is unique to the blocking scheduler as tasks /// scheduled are not really future...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/schedule.rs
MIT
e14ca72e68fbfa04f12408ed916bf5f857dfa232
github
async-runtime
https://github.com/tokio-rs/tokio/blob/e14ca72e68fbfa04f12408ed916bf5f857dfa232/tokio/src/runtime/blocking/schedule.rs
1
56
tokio-rs/tokio:tokio/src/runtime/blocking/schedule.rs:1
use crate::runtime::task::{self, Task}; /// `task::Schedule` implementation that does nothing. This is unique to the /// blocking scheduler as tasks scheduled are not really futures but blocking /// operations. /// /// We avoid storing the task by forgetting it in `bind` and re-materializing it /// in `release. pub(cr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/schedule.rs
MIT
2087f3e0ebb08d633d59c5f964b3901e68b3c038
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2087f3e0ebb08d633d59c5f964b3901e68b3c038/tokio/src/runtime/blocking/schedule.rs
1
19
tokio-rs/tokio:tokio/src/runtime/blocking/schedule.rs:1
use crate::runtime::task::{self, Task}; /// `task::Schedule` implementation that does nothing. This is unique to the /// blocking scheduler as tasks scheduled are not really futures but blocking /// operations. /// /// We avoid storing the task by forgetting it in `bind` and re-materializing it /// in `release. pub(cr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/schedule.rs
MIT
07533a5255a6516b6e92c45e571a9ba497cb25d4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/07533a5255a6516b6e92c45e571a9ba497cb25d4/tokio/src/runtime/blocking/schedule.rs
1
24
tokio-rs/tokio:tokio/src/runtime/blocking/schedule.rs:1
use crate::runtime::task::{self, Task}; /// `task::Schedule` implementation that does nothing. This is unique to the /// blocking scheduler as tasks scheduled are not really futures but blocking /// operations. /// /// We avoid storing the task by forgetting it in `bind` and re-materializing it /// in `release. pub(su...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/schedule.rs
MIT
a78b1c65ccfb9692ca5d3ed8ddde934f40091d83
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a78b1c65ccfb9692ca5d3ed8ddde934f40091d83/tokio/src/runtime/blocking/schedule.rs
1
24
tokio-rs/tokio:tokio/src/runtime/blocking/schedule.rs:1
use crate::task::{Schedule, ScheduleSendOnly, Task}; /// `task::Schedule` implementation that does nothing. This is unique to the /// blocking scheduler as tasks scheduled are not really futures but blocking /// operations. pub(super) struct NoopSchedule; impl Schedule for NoopSchedule { fn bind(&self, _task: &Ta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/schedule.rs
MIT
38e602f4d812c196d5dc0bc245e79ccad4e77cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/38e602f4d812c196d5dc0bc245e79ccad4e77cfd/tokio/src/runtime/blocking/schedule.rs
1
20
tokio-rs/tokio:tokio/src/runtime/blocking/sharded_queue.rs:1
//! A sharded concurrent queue for the blocking pool. //! //! This implementation distributes tasks across multiple shards to reduce //! lock contention when many threads are spawning blocking tasks concurrently. //! The push operations use per-shard locking, while notifications use a global //! condvar for simplicity....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/sharded_queue.rs
MIT
1604bc335157be9a131e24cfde55cab3c90ebc92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1604bc335157be9a131e24cfde55cab3c90ebc92/tokio/src/runtime/blocking/sharded_queue.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/sharded_queue.rs:2
fn new() -> Self { Shard { queue: Mutex::new(VecDeque::new()), } } /// Push a task to this shard's queue. fn push(&self, task: Task) { let mut queue = self.queue.lock(); // Check if pushing would require reallocation (when len == capacity). // If so, all...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/sharded_queue.rs
MIT
1604bc335157be9a131e24cfde55cab3c90ebc92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1604bc335157be9a131e24cfde55cab3c90ebc92/tokio/src/runtime/blocking/sharded_queue.rs
41
100
tokio-rs/tokio:tokio/src/runtime/blocking/sharded_queue.rs:3
} /// Try to pop a task from this shard's queue. fn pop(&self) -> Option<Task> { let mut queue = self.queue.lock(); queue.pop_front() } } /// A sharded queue that distributes tasks across multiple shards. pub(super) struct ShardedQueue { /// The shards - each with its own mutex-protect...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/sharded_queue.rs
MIT
1604bc335157be9a131e24cfde55cab3c90ebc92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1604bc335157be9a131e24cfde55cab3c90ebc92/tokio/src/runtime/blocking/sharded_queue.rs
81
140
tokio-rs/tokio:tokio/src/runtime/blocking/sharded_queue.rs:4
/// Select the next shard index for pushing a task -- when the RNG is /// available. #[cfg(not(loom))] fn next_push_index(&self, num_shards: usize) -> usize { crate::runtime::context::thread_rng_n(num_shards as u32) as usize } /// Select the next shard index for pushing a task -- when the R...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/sharded_queue.rs
MIT
1604bc335157be9a131e24cfde55cab3c90ebc92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1604bc335157be9a131e24cfde55cab3c90ebc92/tokio/src/runtime/blocking/sharded_queue.rs
121
180
tokio-rs/tokio:tokio/src/runtime/blocking/sharded_queue.rs:5
if let Some(task) = self.shards[index].pop() { return Some(task); } } None } /// Set the shutdown flag and wake all workers. pub(super) fn shutdown(&self) { // Set the flag while holding condvar_mutex so that any worker // currently inside `wait_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/sharded_queue.rs
MIT
1604bc335157be9a131e24cfde55cab3c90ebc92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1604bc335157be9a131e24cfde55cab3c90ebc92/tokio/src/runtime/blocking/sharded_queue.rs
161
220
tokio-rs/tokio:tokio/src/runtime/blocking/sharded_queue.rs:6
// A notification is pending — a task was pushed. *guard -= 1; drop(guard); // Pop outside the condvar_mutex to avoid holding two locks. if let Some(task) = self.pop(preferred_shard) { return WaitResult::Task(task); } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/sharded_queue.rs
MIT
1604bc335157be9a131e24cfde55cab3c90ebc92
github
async-runtime
https://github.com/tokio-rs/tokio/blob/1604bc335157be9a131e24cfde55cab3c90ebc92/tokio/src/runtime/blocking/sharded_queue.rs
201
238
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:1
//! A shutdown channel. //! //! Each worker holds the `Sender` half. When all the `Sender` halves are //! dropped, the `Receiver` receives a notification. use crate::loom::sync::Arc; use crate::sync::oneshot; use std::time::Duration; #[derive(Debug, Clone)] pub(super) struct Sender { _tx: Arc<oneshot::Sender<()>...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/blocking/shutdown.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:2
return false; } let mut e = match try_enter_blocking_region() { Some(enter) => enter, _ => { if std::thread::panicking() { // Don't panic in a panic return false; } else { panic!( ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/blocking/shutdown.rs
41
71
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:1
//! A shutdown channel. //! //! Each worker holds the `Sender` half. When all the `Sender` halves are //! dropped, the `Receiver` receives a notification. use crate::loom::sync::Arc; use crate::sync::oneshot; use std::time::Duration; #[derive(Debug, Clone)] pub(super) struct Sender { _tx: Arc<oneshot::Sender<()>...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
32da1aa9da833f6db59d6a97e2a569b780d9f6b4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/32da1aa9da833f6db59d6a97e2a569b780d9f6b4/tokio/src/runtime/blocking/shutdown.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:1
//! A shutdown channel. //! //! Each worker holds the `Sender` half. When all the `Sender` halves are //! dropped, the `Receiver` receives a notification. use crate::loom::sync::Arc; use crate::sync::oneshot; use std::time::Duration; #[derive(Debug, Clone)] pub(super) struct Sender { _tx: Arc<oneshot::Sender<()>...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
c5d37204dc7c4a3f1de2e413f151bd7d23e7e63d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c5d37204dc7c4a3f1de2e413f151bd7d23e7e63d/tokio/src/runtime/blocking/shutdown.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:2
return false; } let mut e = match try_enter(false) { Some(enter) => enter, _ => { if std::thread::panicking() { // Don't panic in a panic return false; } else { panic!( ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
c5d37204dc7c4a3f1de2e413f151bd7d23e7e63d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c5d37204dc7c4a3f1de2e413f151bd7d23e7e63d/tokio/src/runtime/blocking/shutdown.rs
41
71
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:1
//! A shutdown channel. //! //! Each worker holds the `Sender` half. When all the `Sender` halves are //! dropped, the `Receiver` receives a notification. use crate::loom::sync::Arc; use crate::sync::oneshot; use std::time::Duration; #[derive(Debug, Clone)] pub(super) struct Sender { tx: Arc<oneshot::Sender<()>>...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
0acd06b42a9d1461302388f2a533e86d391d6040
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0acd06b42a9d1461302388f2a533e86d391d6040/tokio/src/runtime/blocking/shutdown.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:1
//! A shutdown channel. //! //! Each worker holds the `Sender` half. When all the `Sender` halves are //! dropped, the `Receiver` receives a notification. use crate::loom::sync::Arc; use crate::sync::oneshot; use std::time::Duration; #[derive(Debug, Clone)] pub(super) struct Sender { tx: Arc<oneshot::Sender<()>>...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/runtime/blocking/shutdown.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:2
return true; } let mut e = match try_enter(false) { Some(enter) => enter, _ => { if std::thread::panicking() { // Don't panic in a panic return false; } else { panic!( ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
646fbae76535e397ef79dbcaacb945d4c829f666
github
async-runtime
https://github.com/tokio-rs/tokio/blob/646fbae76535e397ef79dbcaacb945d4c829f666/tokio/src/runtime/blocking/shutdown.rs
41
71
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:1
//! A shutdown channel. //! //! Each worker holds the `Sender` half. When all the `Sender` halves are //! dropped, the `Receiver` receives a notification. use crate::loom::sync::Arc; use crate::sync::oneshot; use std::time::Duration; #[derive(Debug, Clone)] pub(super) struct Sender { tx: Arc<oneshot::Sender<()>>...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
04a2826084743e80762a32fcee912a3dfbb86a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/04a2826084743e80762a32fcee912a3dfbb86a63/tokio/src/runtime/blocking/shutdown.rs
1
60
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:2
let mut e = match try_enter(false) { Some(enter) => enter, _ => { if std::thread::panicking() { // Don't panic in a panic return; } else { panic!( "Cannot drop a runtime in a conte...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
04a2826084743e80762a32fcee912a3dfbb86a63
github
async-runtime
https://github.com/tokio-rs/tokio/blob/04a2826084743e80762a32fcee912a3dfbb86a63/tokio/src/runtime/blocking/shutdown.rs
41
68
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:1
//! A shutdown channel. //! //! Each worker holds the `Sender` half. When all the `Sender` halves are //! dropped, the `Receiver` receives a notification. use crate::loom::sync::Arc; use crate::sync::oneshot; use std::time::Duration; #[derive(Debug, Clone)] pub(super) struct Sender { tx: Arc<oneshot::Sender<()>>...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
282b00cbe888a96669877ce70662fba87e8c0e3c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/282b00cbe888a96669877ce70662fba87e8c0e3c/tokio/src/runtime/blocking/shutdown.rs
1
58
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:1
//! A shutdown channel. //! //! Each worker holds the `Sender` half. When all the `Sender` halves are //! dropped, the `Receiver` receives a notification. use crate::loom::sync::Arc; use crate::sync::oneshot; use std::time::Duration; #[derive(Debug, Clone)] pub(super) struct Sender { tx: Arc<oneshot::Sender<()>>...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
9d6b99494b72e79b4afba5073a9ebef5bbbeca8a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9d6b99494b72e79b4afba5073a9ebef5bbbeca8a/tokio/src/runtime/blocking/shutdown.rs
1
58
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:1
//! A shutdown channel. //! //! Each worker holds the `Sender` half. When all the `Sender` halves are //! dropped, the `Receiver` receives a notification. use crate::loom::sync::Arc; use crate::sync::oneshot; #[derive(Debug, Clone)] pub(super) struct Sender { tx: Arc<oneshot::Sender<()>>, } #[derive(Debug)] pub(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/runtime/blocking/shutdown.rs
1
48
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:1
//! A shutdown channel. //! //! Each worker holds the `Sender` half. When all the `Sender` halves are //! dropped, the `Receiver` receives a notification. use crate::loom::sync::Arc; use crate::sync::oneshot; #[derive(Debug, Clone)] pub(super) struct Sender { tx: Arc<oneshot::Sender<()>>, } #[derive(Debug)] pub(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
adc5186ebd1290c2f144e153a87e147d257f8b0f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/adc5186ebd1290c2f144e153a87e147d257f8b0f/tokio/src/runtime/blocking/shutdown.rs
1
48
tokio-rs/tokio:tokio/src/runtime/blocking/shutdown.rs:1
//! A shutdown channel. //! //! Each worker holds the `Sender` half. When all the `Sender` halves are //! dropped, the `Receiver` receives a notification. use crate::loom::sync::Arc; use crate::sync::oneshot; #[derive(Debug, Clone)] pub(super) struct Sender { tx: Arc<oneshot::Sender<()>>, } #[derive(Debug)] pub(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/shutdown.rs
MIT
8546ff826db8dba1e39b4119ad909fb6cab2492a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/8546ff826db8dba1e39b4119ad909fb6cab2492a/tokio/src/runtime/blocking/shutdown.rs
1
44
tokio-rs/tokio:tokio/src/runtime/blocking/task.rs:1
use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; /// Converts a function to a future that completes on poll. pub(crate) struct BlockingTask<T> { func: Option<T>, } impl<T> BlockingTask<T> { /// Initializes a new blocking task from the given function. pub(crate) fn new(func: T) -...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/task.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/blocking/task.rs
1
44
tokio-rs/tokio:tokio/src/runtime/blocking/task.rs:1
use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; /// Converts a function to a future that completes on poll. pub(crate) struct BlockingTask<T> { func: Option<T>, } impl<T> BlockingTask<T> { /// Initializes a new blocking task from the given function. pub(crate) fn new(func: T) -...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/task.rs
MIT
a051ed726f3b99b077e8c9ef8ef1df2ab2943213
github
async-runtime
https://github.com/tokio-rs/tokio/blob/a051ed726f3b99b077e8c9ef8ef1df2ab2943213/tokio/src/runtime/blocking/task.rs
1
44
tokio-rs/tokio:tokio/src/runtime/blocking/task.rs:1
use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; /// Converts a function to a future that completes on poll. pub(crate) struct BlockingTask<T> { func: Option<T>, } impl<T> BlockingTask<T> { /// Initializes a new blocking task from the given function. pub(crate) fn new(func: T) -...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/task.rs
MIT
03969cdae7674681d1b10926e6a56fbb8908dbb8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/03969cdae7674681d1b10926e6a56fbb8908dbb8/tokio/src/runtime/blocking/task.rs
1
44
tokio-rs/tokio:tokio/src/runtime/blocking/task.rs:1
use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; /// Converts a function to a future that completes on poll pub(crate) struct BlockingTask<T> { func: Option<T>, } impl<T> BlockingTask<T> { /// Initializes a new blocking task from the given function pub(crate) fn new(func: T) -> ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/task.rs
MIT
20a2b9e26316e704d16c62a28dfb74a505b92b25
github
async-runtime
https://github.com/tokio-rs/tokio/blob/20a2b9e26316e704d16c62a28dfb74a505b92b25/tokio/src/runtime/blocking/task.rs
1
44
tokio-rs/tokio:tokio/src/runtime/blocking/task.rs:1
use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; /// Converts a function to a future that completes on poll pub(crate) struct BlockingTask<T> { func: Option<T>, } impl<T> BlockingTask<T> { /// Initializes a new blocking task from the given function pub(crate) fn new(func: T) -> ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/task.rs
MIT
6b6e76080afc92450238df69c4edc12ee5f7518d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6b6e76080afc92450238df69c4edc12ee5f7518d/tokio/src/runtime/blocking/task.rs
1
43
tokio-rs/tokio:tokio/src/runtime/blocking/task.rs:1
use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; /// Converts a function to a future that completes on poll pub(crate) struct BlockingTask<T> { func: Option<T>, } impl<T> BlockingTask<T> { /// Initializes a new blocking task from the given function pub(crate) fn new(func: T) -> ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/task.rs
MIT
07533a5255a6516b6e92c45e571a9ba497cb25d4
github
async-runtime
https://github.com/tokio-rs/tokio/blob/07533a5255a6516b6e92c45e571a9ba497cb25d4/tokio/src/runtime/blocking/task.rs
1
40
tokio-rs/tokio:tokio/src/runtime/blocking/task.rs:1
use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; /// Converts a function to a future that completes on poll pub(super) struct BlockingTask<T> { func: Option<T>, } impl<T> BlockingTask<T> { /// Initializes a new blocking task from the given function pub(super) fn new(func: T) -> ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/task.rs
MIT
06a4d895ec8787386058a24b422dfa9a8514bc8e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/06a4d895ec8787386058a24b422dfa9a8514bc8e/tokio/src/runtime/blocking/task.rs
1
40
tokio-rs/tokio:tokio/src/runtime/blocking/task.rs:1
use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; /// Converts a function to a future that completes on poll pub(super) struct BlockingTask<T> { func: Option<T>, } impl<T> BlockingTask<T> { /// Initializes a new blocking task from the given function pub(super) fn new(func: T) -> ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/blocking/task.rs
MIT
f9ddb93604a830d106475bd4c4cae436fafcc0da
github
async-runtime
https://github.com/tokio-rs/tokio/blob/f9ddb93604a830d106475bd4c4cae436fafcc0da/tokio/src/runtime/blocking/task.rs
1
32
tokio-rs/tokio:tokio/src/runtime/builder.rs:1
#![cfg_attr(loom, allow(unused_imports))] use crate::runtime::handle::Handle; use crate::runtime::{ blocking, driver, Callback, HistogramBuilder, Runtime, TaskCallback, TimerFlavor, }; #[cfg(tokio_unstable)] use crate::runtime::{metrics::HistogramConfiguration, TaskMeta}; use crate::runtime::{LocalOptions, LocalR...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
1
60
tokio-rs/tokio:tokio/src/runtime/builder.rs:2
/// /// fn main() { /// // build runtime /// let runtime = Builder::new_multi_thread() /// .worker_threads(4) /// .thread_name("my-custom-name") /// .thread_stack_size(3 * 1024 * 1024) /// .build() /// .unwrap(); /// /// // use runtime ... /// } /// # } /// ``` pub st...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
41
100
tokio-rs/tokio:tokio/src/runtime/builder.rs:3
pub(super) thread_name: ThreadNameFn, /// Stack size used for threads spawned by the runtime. pub(super) thread_stack_size: Option<usize>, /// Callback to run after each thread starts. pub(super) after_start: Option<Callback>, /// To run before each worker thread stops pub(super) before_stop:...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
81
140
tokio-rs/tokio:tokio/src/runtime/builder.rs:4
/// self-tuning strategy based on mean task poll times. pub(super) global_queue_interval: Option<u32>, /// How many ticks before yielding to the driver for timer and I/O events? pub(super) event_interval: u32, /// When true, the multi-threade scheduler LIFO slot should not be used. /// /// Thi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
121
180
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
/// 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
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
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`], or call [`build_local`] to create...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:8
kind, // Default runtime name name: None, // 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, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/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, seed_generator: RngSeedGenerator::new(RngSeed::new()), #[cfg(tokio_unstable)] ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
/// .enable_all() /// .build() /// .unwrap(); /// # } /// ``` pub fn enable_all(&mut self) -> &mut Self { #[cfg(any( feature = "net", all(unix, feature = "process"), all(unix, feature = "signal") ))] self.enable_io(); #...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
361
420
tokio-rs/tokio:tokio/src/runtime/builder.rs:11
/// /// ``` /// # #[cfg(not(target_family = "wasm"))] /// # { /// use tokio::runtime; /// /// let rt = runtime::Builder::new_multi_thread() /// .enable_alt_timer() /// .build() /// .unwrap(); /// # } /// ``` #[cfg(all(tokio_unstable, feature = "time", feature = "rt-...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
401
460
tokio-rs/tokio:tokio/src/runtime/builder.rs:15
assert!(val > 0, "Max blocking threads cannot be set to 0"); self.max_blocking_threads = val; self } /// Sets name of threads spawned by the `Runtime`'s thread pool. /// /// The default name is "tokio-rt-worker". /// /// # Examples /// /// ``` /// # #[cfg(not(target_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
561
620
tokio-rs/tokio:tokio/src/runtime/builder.rs:16
/// .name("my-runtime") /// .build(); /// # } /// # } /// ``` /// # Panics /// /// This function will panic if an empty value is passed as an argument. /// #[track_caller] pub fn name(&mut self, val: impl Into<String>) -> &mut Self { let val = val.into(); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
601
660
tokio-rs/tokio:tokio/src/runtime/builder.rs:17
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 than this value if the platform /// specifies minimal stack size. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
641
700
tokio-rs/tokio:tokio/src/runtime/builder.rs:18
/// /// ``` /// # #[cfg(not(target_family = "wasm"))] /// # { /// # use tokio::runtime; /// # pub fn main() { /// let runtime = runtime::Builder::new_multi_thread() /// .on_thread_start(|| { /// println!("thread started"); /// }) /// .build(); /// # } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
681
740
tokio-rs/tokio:tokio/src/runtime/builder.rs:21
/// }) /// # } /// ``` #[cfg(not(loom))] pub fn on_thread_park<F>(&mut self, f: F) -> &mut Self where F: Fn() + Send + Sync + 'static, { self.before_park = Some(std::sync::Arc::new(f)); self } /// Executes function `f` just after a thread unparks (starts executin...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
801
860
tokio-rs/tokio:tokio/src/runtime/builder.rs:22
/// ``` #[cfg(not(loom))] pub fn on_thread_unpark<F>(&mut self, f: F) -> &mut Self where F: Fn() + Send + Sync + 'static, { self.after_unpark = Some(std::sync::Arc::new(f)); self } /// Executes function `f` just before a task is spawned. /// /// `f` is called wit...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
841
900
tokio-rs/tokio:tokio/src/runtime/builder.rs:27
self } /// Creates the configured `Runtime`. /// /// The returned `Runtime` instance is ready to spawn tasks. /// /// # Examples /// /// ``` /// # #[cfg(not(target_family = "wasm"))] /// # { /// use tokio::runtime::Builder; /// /// let rt = Builder::new_multi_thread...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
1,041
1,100
tokio-rs/tokio:tokio/src/runtime/builder.rs:28
/// /// ``` /// use tokio::runtime::{Builder, LocalOptions}; /// /// let rt = Builder::new_current_thread() /// .build_local(LocalOptions::default()) /// .unwrap(); /// /// rt.spawn_local(async { /// println!("Hello from the Tokio runtime"); /// }); /// ``` #[...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
1,081
1,140
tokio-rs/tokio:tokio/src/runtime/builder.rs:41
self } /// Sets the number of buckets for the histogram tracking the /// distribution of task poll times. /// /// The last bucket tracks all greater values that fall out of other /// ranges. So, configuring the histogram using a linear scale, /// resolution of 50...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
1,601
1,660
tokio-rs/tokio:tokio/src/runtime/builder.rs:42
Ok(Runtime::from_parts( Scheduler::CurrentThread(scheduler), handle, blocking_pool, )) } fn build_current_thread_local_runtime(&mut self) -> io::Result<LocalRuntime> { use crate::runtime::local_runtime::LocalRuntimeScheduler; let tid = std::thread::c...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
1,641
1,700
tokio-rs/tokio:tokio/src/runtime/builder.rs:43
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
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
1,681
1,740
tokio-rs/tokio:tokio/src/runtime/builder.rs:44
Ok((scheduler, handle, blocking_pool)) } fn metrics_poll_count_histogram_builder(&self) -> Option<HistogramBuilder> { if self.metrics_poll_count_histogram_enable { Some(self.metrics_poll_count_histogram.clone()) } else { None } } } cfg_io_driver! { impl ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
1,721
1,780
tokio-rs/tokio:tokio/src/runtime/builder.rs:45
/// use tokio::runtime; /// /// let rt = runtime::Builder::new_current_thread() /// .enable_io() /// .max_io_events_per_tick(1024) /// .build() /// .unwrap(); /// ``` pub fn max_io_events_per_tick(&mut self, capacity: usize) -> &mut Self { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
1,761
1,820
tokio-rs/tokio:tokio/src/runtime/builder.rs:46
cfg_io_uring! { impl Builder { /// Enables the tokio's io_uring driver. /// /// Doing this enables using io_uring operations on the runtime. /// /// # Examples /// /// ``` /// use tokio::runtime; /// /// let rt = runtime::Builder::new_m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
1,801
1,860
tokio-rs/tokio:tokio/src/runtime/builder.rs:47
/// .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 Builder { fn build_threaded_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
1,841
1,900
tokio-rs/tokio:tokio/src/runtime/builder.rs:48
before_spawn: self.before_spawn.clone(), #[cfg(tokio_unstable)] before_poll: self.before_poll.clone(), #[cfg(tokio_unstable)] after_poll: self.after_poll.clone(), after_termination: self.after_termination.clone(), ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
1,881
1,940
tokio-rs/tokio:tokio/src/runtime/builder.rs:49
.field("max_blocking_threads", &self.max_blocking_threads) .field( "thread_name", &"<dyn Fn() -> String + Send + Sync + 'static>", ) .field("thread_stack_size", &self.thread_stack_size) .field("after_start", &self.after_start.as_ref().map(|...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/builder.rs
1,921
1,942
tokio-rs/tokio:tokio/src/runtime/builder.rs:4
/// self-tuning strategy based on mean task poll times. pub(super) global_queue_interval: Option<u32>, /// How many ticks before yielding to the driver for timer and I/O events? pub(super) event_interval: u32, /// When true, the multi-threade scheduler LIFO slot should not be used. /// /// Thi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
967f5715a71d5d2600b71da8c4ab652c4e644a41
github
async-runtime
https://github.com/tokio-rs/tokio/blob/967f5715a71d5d2600b71da8c4ab652c4e644a41/tokio/src/runtime/builder.rs
121
180
tokio-rs/tokio:tokio/src/runtime/builder.rs:6
/// immediately dropped and call to [`Runtime::block_on`] will panic. /// /// # Examples /// /// ```should_panic /// use tokio::runtime::{self, UnhandledPanic}; /// /// # pub fn main() { /// let rt = runtime::Builder::new_current_thread() /// ....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
967f5715a71d5d2600b71da8c4ab652c4e644a41
github
async-runtime
https://github.com/tokio-rs/tokio/blob/967f5715a71d5d2600b71da8c4ab652c4e644a41/tokio/src/runtime/builder.rs
201
260
tokio-rs/tokio:tokio/src/runtime/builder.rs:7
/// 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`], or call [`build_local`] to create a [`LocalRuntime`]. /// //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
967f5715a71d5d2600b71da8c4ab652c4e644a41
github
async-runtime
https://github.com/tokio-rs/tokio/blob/967f5715a71d5d2600b71da8c4ab652c4e644a41/tokio/src/runtime/builder.rs
241
300
tokio-rs/tokio:tokio/src/runtime/builder.rs:8
// 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 mode. /...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
967f5715a71d5d2600b71da8c4ab652c4e644a41
github
async-runtime
https://github.com/tokio-rs/tokio/blob/967f5715a71d5d2600b71da8c4ab652c4e644a41/tokio/src/runtime/builder.rs
281
340
tokio-rs/tokio:tokio/src/runtime/builder.rs:9
// as parameters. global_queue_interval: None, event_interval, seed_generator: RngSeedGenerator::new(RngSeed::new()), #[cfg(tokio_unstable)] unhandled_panic: UnhandledPanic::Ignore, metrics_poll_count_histogram_enable: false, metric...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
967f5715a71d5d2600b71da8c4ab652c4e644a41
github
async-runtime
https://github.com/tokio-rs/tokio/blob/967f5715a71d5d2600b71da8c4ab652c4e644a41/tokio/src/runtime/builder.rs
321
380
tokio-rs/tokio:tokio/src/runtime/builder.rs:10
feature = "net", all(unix, feature = "process"), all(unix, feature = "signal") ))] self.enable_io(); #[cfg(all( tokio_unstable, feature = "io-uring", feature = "rt", feature = "fs", target_os = "linux", ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/builder.rs
MIT
967f5715a71d5d2600b71da8c4ab652c4e644a41
github
async-runtime
https://github.com/tokio-rs/tokio/blob/967f5715a71d5d2600b71da8c4ab652c4e644a41/tokio/src/runtime/builder.rs
361
420