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/threadpool/builder.rs:9 | reactor_handles.push(reactor.handle());
// Create a new timer.
let timer = Timer::new_with_now(reactor, self.clock.clone());
timer_handles.push(timer.handle());
timers.push(Mutex::new(Some(timer)));
}
// Get a handle to the clock for the runtime.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | d1f60ac4c69792211f9c9f3bcff1559bc0cb837a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f60ac4c69792211f9c9f3bcff1559bc0cb837a/tokio/src/runtime/threadpool/builder.rs | 321 | 379 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:10 | .unwrap()
})
.build();
Ok(Runtime {
inner: Some(Inner {
pool,
background,
trace,
}),
})
}
}
impl Default for Builder {
fn default() -> Self {
Self::new()
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | d1f60ac4c69792211f9c9f3bcff1559bc0cb837a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f60ac4c69792211f9c9f3bcff1559bc0cb837a/tokio/src/runtime/threadpool/builder.rs | 361 | 379 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:1 | use super::{background, Inner, Runtime};
use tokio_executor::threadpool;
use tokio_net::driver::{self, Reactor};
use tokio_timer::clock::{self, Clock};
use tokio_timer::timer::{self, Timer};
use num_cpus;
use tracing_core as trace;
use std::io;
use std::sync::Mutex;
use std::time::Duration;
use std::any::Any;
/// Bu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | f1f61a3b15d17767b12bfd8c0c5712db1b089b0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f1f61a3b15d17767b12bfd8c0c5712db1b089b0b/tokio/src/runtime/threadpool/builder.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:3 | /// Set the `Clock` instance that will be used by the runtime.
pub fn clock(&mut self, clock: Clock) -> &mut Self {
self.clock = clock;
self
}
/// Sets a callback to handle panics in futures.
///
/// The callback is triggered when a panic during a future bubbles up to
/// Tokio.... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | f1f61a3b15d17767b12bfd8c0c5712db1b089b0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f1f61a3b15d17767b12bfd8c0c5712db1b089b0b/tokio/src/runtime/threadpool/builder.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:1 | use super::{background, Inner, Runtime};
use crate::reactor::Reactor;
use tokio_executor::threadpool;
use tokio_timer::clock::{self, Clock};
use tokio_timer::timer::{self, Timer};
use num_cpus;
use tracing_core as trace;
use std::io;
use std::sync::Mutex;
use std::time::Duration;
use std::any::Any;
/// Builds Tokio ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | 3b27dc31d28df93fcc65ed3b744033d4ad4f77cc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b27dc31d28df93fcc65ed3b744033d4ad4f77cc/tokio/src/runtime/threadpool/builder.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:9 | reactor_handles.push(reactor.handle());
// Create a new timer.
let timer = Timer::new_with_now(reactor, self.clock.clone());
timer_handles.push(timer.handle());
timers.push(Mutex::new(Some(timer)));
}
// Get a handle to the clock for the runtime.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | 3b27dc31d28df93fcc65ed3b744033d4ad4f77cc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b27dc31d28df93fcc65ed3b744033d4ad4f77cc/tokio/src/runtime/threadpool/builder.rs | 321 | 379 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:1 | use super::{background, Inner, Runtime};
use crate::reactor::Reactor;
use tokio_threadpool::Builder as ThreadPoolBuilder;
use tokio_timer::clock::{self, Clock};
use tokio_timer::timer::{self, Timer};
use num_cpus;
use tracing_core as trace;
use std::io;
use std::sync::Mutex;
use std::time::Duration;
use std::any::Any... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | 37131b21144de133628b54a1de500b623058f8cf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37131b21144de133628b54a1de500b623058f8cf/tokio/src/runtime/threadpool/builder.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:2 | /// .core_threads(4)
/// .keep_alive(Some(Duration::from_secs(60)))
/// .name_prefix("my-custom-name-")
/// .stack_size(3 * 1024 * 1024)
/// .build()
/// .unwrap();
///
/// // use runtime ...
/// }
/// ```
#[derive(Debug)]
pub struct Builder {
/// Thread pool spec... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | 37131b21144de133628b54a1de500b623058f8cf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37131b21144de133628b54a1de500b623058f8cf/tokio/src/runtime/threadpool/builder.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:9 | reactor_handles.push(reactor.handle());
// Create a new timer.
let timer = Timer::new_with_now(reactor, self.clock.clone());
timer_handles.push(timer.handle());
timers.push(Mutex::new(Some(timer)));
}
// Get a handle to the clock for the runtime.
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | 8538c25170240fa46313ffe9d4a9a2f9ba2536e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8538c25170240fa46313ffe9d4a9a2f9ba2536e5/tokio/src/runtime/threadpool/builder.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:10 | .unwrap()
.take()
.unwrap()
})
.build();
Ok(Runtime {
inner: Some(Inner {
pool,
background,
trace,
}),
})
}
}
impl Default for Builder {
fn default() -> Self ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | 8538c25170240fa46313ffe9d4a9a2f9ba2536e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8538c25170240fa46313ffe9d4a9a2f9ba2536e5/tokio/src/runtime/threadpool/builder.rs | 361 | 381 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:1 | use super::{background, Inner, Runtime};
use crate::reactor::Reactor;
use tokio_reactor;
use tokio_threadpool::Builder as ThreadPoolBuilder;
use tokio_timer::clock::{self, Clock};
use tokio_timer::timer::{self, Timer};
use num_cpus;
use tracing_core as trace;
use std::io;
use std::sync::Mutex;
use std::time::Duration... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | fe021e6c008a886c1c6ad97c9f5f0c667fad34c6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fe021e6c008a886c1c6ad97c9f5f0c667fad34c6/tokio/src/runtime/threadpool/builder.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:2 | /// .clock(Clock::system())
/// .core_threads(4)
/// .keep_alive(Some(Duration::from_secs(60)))
/// .name_prefix("my-custom-name-")
/// .stack_size(3 * 1024 * 1024)
/// .build()
/// .unwrap();
///
/// // use runtime ...
/// }
/// ```
#[derive(Debug)]
pub struc... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | fe021e6c008a886c1c6ad97c9f5f0c667fad34c6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fe021e6c008a886c1c6ad97c9f5f0c667fad34c6/tokio/src/runtime/threadpool/builder.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:3 | }
/// Set the `Clock` instance that will be used by the runtime.
pub fn clock(&mut self, clock: Clock) -> &mut Self {
self.clock = clock;
self
}
/// Sets a callback to handle panics in futures.
///
/// The callback is triggered when a panic during a future bubbles up to
///... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | fe021e6c008a886c1c6ad97c9f5f0c667fad34c6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fe021e6c008a886c1c6ad97c9f5f0c667fad34c6/tokio/src/runtime/threadpool/builder.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:7 | /// # }
/// ```
pub fn stack_size(&mut self, val: usize) -> &mut Self {
self.threadpool_builder.stack_size(val);
self
}
/// Execute function `f` after each thread is started but before it starts
/// doing work.
///
/// This is intended for bookkeeping and monitoring use case... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | fe021e6c008a886c1c6ad97c9f5f0c667fad34c6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fe021e6c008a886c1c6ad97c9f5f0c667fad34c6/tokio/src/runtime/threadpool/builder.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:8 | ///
/// # pub fn main() {
/// let thread_pool = runtime::Builder::new()
/// .before_stop(|| {
/// println!("thread stopping");
/// })
/// .build();
/// # }
/// ```
pub fn before_stop<F>(&mut self, f: F) -> &mut Self
where F: Fn() + Send + Sync + 'static
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | fe021e6c008a886c1c6ad97c9f5f0c667fad34c6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fe021e6c008a886c1c6ad97c9f5f0c667fad34c6/tokio/src/runtime/threadpool/builder.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:9 | let reactor = Reactor::new()?;
reactor_handles.push(reactor.handle());
// Create a new timer.
let timer = Timer::new_with_now(reactor, self.clock.clone());
timer_handles.push(timer.handle());
timers.push(Mutex::new(Some(timer)));
}
// Get a h... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | fe021e6c008a886c1c6ad97c9f5f0c667fad34c6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fe021e6c008a886c1c6ad97c9f5f0c667fad34c6/tokio/src/runtime/threadpool/builder.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:10 | .lock()
.unwrap()
.take()
.unwrap()
})
.build();
Ok(Runtime {
inner: Some(Inner {
pool,
background,
trace,
}),
})
}
}
impl Default for Builder... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | fe021e6c008a886c1c6ad97c9f5f0c667fad34c6 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/fe021e6c008a886c1c6ad97c9f5f0c667fad34c6/tokio/src/runtime/threadpool/builder.rs | 361 | 382 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:9 | let reactor = Reactor::new()?;
reactor_handles.push(reactor.handle());
// Create a new timer.
let timer = Timer::new_with_now(reactor, self.clock.clone());
timer_handles.push(timer.handle());
timers.push(Mutex::new(Some(timer)));
}
// Get a h... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | 9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8/tokio/src/runtime/threadpool/builder.rs | 321 | 376 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:10 | .lock()
.unwrap()
.take()
.unwrap()
})
.build();
Ok(Runtime {
inner: Some(Inner {
pool,
background,
trace,
}),
})
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | 9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8/tokio/src/runtime/threadpool/builder.rs | 361 | 376 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:1 | use crate::reactor::Reactor;
use num_cpus;
use tokio_reactor;
use tokio_threadpool::Builder as ThreadPoolBuilder;
use tokio_timer::clock::{self, Clock};
use tokio_timer::timer::{self, Timer};
use tracing_core as trace;
use std::io;
use std::sync::Mutex;
use std::time::Duration;
use std::any::Any;
use super::{Inner, Run... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | 003b4d8074e501f0185d0d38050219ec7b491bc3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/003b4d8074e501f0185d0d38050219ec7b491bc3/tokio/src/runtime/threadpool/builder.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:2 | /// .keep_alive(Some(Duration::from_secs(60)))
/// .name_prefix("my-custom-name-")
/// .stack_size(3 * 1024 * 1024)
/// .build()
/// .unwrap();
///
/// // use runtime ...
/// }
/// ```
#[derive(Debug)]
pub struct Builder {
/// Thread pool specific builder
threadpool_b... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | 003b4d8074e501f0185d0d38050219ec7b491bc3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/003b4d8074e501f0185d0d38050219ec7b491bc3/tokio/src/runtime/threadpool/builder.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:7 | pub fn stack_size(&mut self, val: usize) -> &mut Self {
self.threadpool_builder.stack_size(val);
self
}
/// Execute function `f` after each thread is started but before it starts
/// doing work.
///
/// This is intended for bookkeeping and monitoring use cases.
///
/// # Exa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | 003b4d8074e501f0185d0d38050219ec7b491bc3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/003b4d8074e501f0185d0d38050219ec7b491bc3/tokio/src/runtime/threadpool/builder.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:8 | /// let thread_pool = runtime::Builder::new()
/// .before_stop(|| {
/// println!("thread stopping");
/// })
/// .build();
/// # }
/// ```
pub fn before_stop<F>(&mut self, f: F) -> &mut Self
where F: Fn() + Send + Sync + 'static
{
self.threadpool_builde... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | 003b4d8074e501f0185d0d38050219ec7b491bc3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/003b4d8074e501f0185d0d38050219ec7b491bc3/tokio/src/runtime/threadpool/builder.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:9 | // Create a new timer.
let timer = Timer::new_with_now(reactor, self.clock.clone());
timer_handles.push(timer.handle());
timers.push(Mutex::new(Some(timer)));
}
// Get a handle to the clock for the runtime.
let clock = self.clock.clone();
// Get the ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | 003b4d8074e501f0185d0d38050219ec7b491bc3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/003b4d8074e501f0185d0d38050219ec7b491bc3/tokio/src/runtime/threadpool/builder.rs | 321 | 369 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:8 | /// let thread_pool = runtime::Builder::new()
/// .before_stop(|| {
/// println!("thread stopping");
/// })
/// .build();
/// # }
/// ```
pub fn before_stop<F>(&mut self, f: F) -> &mut Self
where F: Fn() + Send + Sync + 'static
{
self.threadpool_builde... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | bd3f3270dbf632a7e23e82dd93605db1fe050ee9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd3f3270dbf632a7e23e82dd93605db1fe050ee9/tokio/src/runtime/threadpool/builder.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:9 | // Create a new timer.
let timer = Timer::new_with_now(reactor, self.clock.clone());
timer_handles.push(timer.handle());
timers.push(Mutex::new(Some(timer)));
}
// Get a handle to the clock for the runtime.
let clock = self.clock.clone();
// Get the ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | bd3f3270dbf632a7e23e82dd93605db1fe050ee9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/bd3f3270dbf632a7e23e82dd93605db1fe050ee9/tokio/src/runtime/threadpool/builder.rs | 321 | 369 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:2 | /// .keep_alive(Some(Duration::from_secs(60)))
/// .name_prefix("my-custom-name-")
/// .stack_size(3 * 1024 * 1024)
/// .build()
/// .unwrap();
///
/// // use runtime ...
/// }
/// ```
#[derive(Debug)]
pub struct Builder {
/// Thread pool specific builder
threadpool_b... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | af46eac5837af4871144923b1e75f38c41e8896d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/af46eac5837af4871144923b1e75f38c41e8896d/tokio/src/runtime/threadpool/builder.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:3 | /// Set the `Clock` instance that will be used by the runtime.
pub fn clock(&mut self, clock: Clock) -> &mut Self {
self.clock = clock;
self
}
/// Set builder to set up the thread pool instance.
#[deprecated(
since = "0.1.9",
note = "use the `core_threads`, `blocking_thr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | af46eac5837af4871144923b1e75f38c41e8896d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/af46eac5837af4871144923b1e75f38c41e8896d/tokio/src/runtime/threadpool/builder.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:4 | F: Fn(Box<dyn Any + Send>) + Send + Sync + 'static,
{
self.threadpool_builder.panic_handler(f);
self
}
/// Set the maximum number of worker threads for the `Runtime`'s thread pool.
///
/// This must be a number between 1 and 32,768 though it is advised to keep
/// this value on... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | af46eac5837af4871144923b1e75f38c41e8896d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/af46eac5837af4871144923b1e75f38c41e8896d/tokio/src/runtime/threadpool/builder.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:8 | }
/// Execute function `f` before each thread stops.
///
/// This is intended for bookkeeping and monitoring use cases.
///
/// # Examples
///
/// ```
/// # use tokio::runtime;
///
/// # pub fn main() {
/// let thread_pool = runtime::Builder::new()
/// .before_stop(|... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | af46eac5837af4871144923b1e75f38c41e8896d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/af46eac5837af4871144923b1e75f38c41e8896d/tokio/src/runtime/threadpool/builder.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:9 | pub fn build(&mut self) -> io::Result<Runtime> {
// TODO(stjepang): Once we remove the `threadpool_builder` method, remove this line too.
self.threadpool_builder.pool_size(self.core_threads);
let mut reactor_handles = Vec::new();
let mut timer_handles = Vec::new();
let mut timer... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | af46eac5837af4871144923b1e75f38c41e8896d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/af46eac5837af4871144923b1e75f38c41e8896d/tokio/src/runtime/threadpool/builder.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:10 | })
});
})
.custom_park(move |worker_id| {
let index = worker_id.to_usize();
timers[index]
.lock()
.unwrap()
.take()
.unwrap()
})
.build();
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | af46eac5837af4871144923b1e75f38c41e8896d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/af46eac5837af4871144923b1e75f38c41e8896d/tokio/src/runtime/threadpool/builder.rs | 361 | 387 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:1 | use crate::reactor::Reactor;
use num_cpus;
use tokio_reactor;
use tokio_threadpool::Builder as ThreadPoolBuilder;
use tokio_timer::clock::{self, Clock};
use tokio_timer::timer::{self, Timer};
use tokio_trace_core as trace;
use std::io;
use std::sync::Mutex;
use std::time::Duration;
use std::any::Any;
use super::{Inner,... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb4aea394e6851ae8cc45a68beeaf2c93cc9a0c0/tokio/src/runtime/threadpool/builder.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:1 | use super::{Inner, Runtime};
use reactor::Reactor;
use std::io;
use std::sync::Mutex;
use std::time::Duration;
use std::any::Any;
use num_cpus;
use tokio_reactor;
use tokio_threadpool::Builder as ThreadPoolBuilder;
use tokio_timer::clock::{self, Clock};
use tokio_timer::timer::{self, Timer};
use tokio_trace_core as ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | b2b796a228a0c1a2bf62ab7613e1b55c149e434f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2b796a228a0c1a2bf62ab7613e1b55c149e434f/tokio/src/runtime/threadpool/builder.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:2 | /// fn main() {
/// // build Runtime
/// let mut runtime = Builder::new()
/// .blocking_threads(4)
/// .clock(Clock::system())
/// .core_threads(4)
/// .keep_alive(Some(Duration::from_secs(60)))
/// .name_prefix("my-custom-name-")
/// .stack_size(3 * 1024 * 1024)
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | b2b796a228a0c1a2bf62ab7613e1b55c149e434f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2b796a228a0c1a2bf62ab7613e1b55c149e434f/tokio/src/runtime/threadpool/builder.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:3 | threadpool_builder,
core_threads,
clock: Clock::new(),
}
}
/// Set the `Clock` instance that will be used by the runtime.
pub fn clock(&mut self, clock: Clock) -> &mut Self {
self.clock = clock;
self
}
/// Set builder to set up the thread pool instan... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | b2b796a228a0c1a2bf62ab7613e1b55c149e434f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2b796a228a0c1a2bf62ab7613e1b55c149e434f/tokio/src/runtime/threadpool/builder.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:9 | /// ```
pub fn before_stop<F>(&mut self, f: F) -> &mut Self
where F: Fn() + Send + Sync + 'static
{
self.threadpool_builder.before_stop(f);
self
}
/// Create the configured `Runtime`.
///
/// The returned `ThreadPool` instance is ready to spawn tasks.
///
/// # E... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | b2b796a228a0c1a2bf62ab7613e1b55c149e434f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2b796a228a0c1a2bf62ab7613e1b55c149e434f/tokio/src/runtime/threadpool/builder.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:10 | }
// Get a handle to the clock for the runtime.
let clock = self.clock.clone();
// Get the current trace dispatcher.
// TODO(eliza): when `tokio-trace-core` is stable enough to take a
// public API dependency, we should allow users to set a custom
// subscriber for the ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | b2b796a228a0c1a2bf62ab7613e1b55c149e434f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2b796a228a0c1a2bf62ab7613e1b55c149e434f/tokio/src/runtime/threadpool/builder.rs | 361 | 410 |
tokio-rs/tokio:tokio/src/runtime/threadpool/builder.rs:11 | Ok(Runtime {
inner: Some(Inner {
reactor_handle,
reactor: Mutex::new(Some(reactor)),
pool,
}),
})
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/builder.rs | MIT | b2b796a228a0c1a2bf62ab7613e1b55c149e434f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b2b796a228a0c1a2bf62ab7613e1b55c149e434f/tokio/src/runtime/threadpool/builder.rs | 401 | 410 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:1 | mod builder;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::builder::Builder;
mod spawner;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::spawner::Spawner;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | c62ef2d232dea1535a8e22484fa2ca083f03e903 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c62ef2d232dea1535a8e22484fa2ca083f03e903/tokio/src/runtime/threadpool/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:1 | mod builder;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::builder::Builder;
mod spawner;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::spawner::Spawner;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 474befd23c368a34a5f45aab0f3945212109a803 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/474befd23c368a34a5f45aab0f3945212109a803/tokio/src/runtime/threadpool/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:3 | }
/// Spawn a future onto the Tokio runtime.
///
/// This spawns the given future onto the runtime's executor, usually a
/// thread pool. The thread pool is then responsible for polling the future
/// until it completes.
///
/// See [module level][mod] documentation for more details.
//... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 227533d456fe32e48ffcd3796f1e6c8f9318b230 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/227533d456fe32e48ffcd3796f1e6c8f9318b230/tokio/src/runtime/threadpool/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:1 | mod builder;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::builder::Builder;
mod spawner;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::spawner::Spawner;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 99940aeeb478e1c96959aed69561336ab067d0d3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/99940aeeb478e1c96959aed69561336ab067d0d3/tokio/src/runtime/threadpool/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:1 | mod builder;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::builder::Builder;
mod spawner;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::spawner::Spawner;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9/tokio/src/runtime/threadpool/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:3 | ///
/// [mod]: index.html
pub fn new() -> io::Result<Self> {
Builder::new().build()
}
/// Spawn a future onto the Tokio runtime.
///
/// This spawns the given future onto the runtime's executor, usually a
/// thread pool. The thread pool is then responsible for polling the future
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9/tokio/src/runtime/threadpool/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:4 | self
}
/// Run a future to completion on the Tokio runtime.
///
/// This runs the given future on the runtime, blocking until it is
/// complete, and yielding its resolved result. Any tasks or timers which
/// the future spawns internally will be executed on the runtime.
///
/// This me... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9/tokio/src/runtime/threadpool/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | ///
/// let spawner = rt.spawner();
///
/// spawner.spawn(async { println!("hello"); });
/// ```
pub fn spawner(&self) -> Spawner {
let inner = self.inner().pool.spawner().clone();
Spawner::new(inner)
}
/// Signals the runtime to shutdown immediately.
///
/// Blocks ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9/tokio/src/runtime/threadpool/mod.rs | 161 | 212 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:6 | /// ```
///
/// [mod]: index.html
#[allow(warnings)]
pub fn shutdown_now(mut self) {
self.inner.unwrap().pool.shutdown_now();
}
fn inner(&self) -> &Inner {
self.inner.as_ref().unwrap()
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b8cee1a60ad99ef28ec494ae4230e2ef4399fcf9/tokio/src/runtime/threadpool/mod.rs | 201 | 212 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:1 | mod builder;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::builder::Builder;
mod spawner;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::spawner::Spawner;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | ed5a94eb2db95b7cc142045fbbd5d68c6276e04e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ed5a94eb2db95b7cc142045fbbd5d68c6276e04e/tokio/src/runtime/threadpool/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:3 | /// [mod]: index.html
pub fn new() -> io::Result<Self> {
Builder::new().build()
}
/// Spawn a future onto the Tokio runtime.
///
/// This spawns the given future onto the runtime's executor, usually a
/// thread pool. The thread pool is then responsible for polling the future
/// un... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | ed5a94eb2db95b7cc142045fbbd5d68c6276e04e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ed5a94eb2db95b7cc142045fbbd5d68c6276e04e/tokio/src/runtime/threadpool/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:4 | }
/// Run a future to completion on the Tokio runtime.
///
/// This runs the given future on the runtime, blocking until it is
/// complete, and yielding its resolved result. Any tasks or timers which
/// the future spawns internally will be executed on the runtime.
///
/// This method shou... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | ed5a94eb2db95b7cc142045fbbd5d68c6276e04e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ed5a94eb2db95b7cc142045fbbd5d68c6276e04e/tokio/src/runtime/threadpool/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | /// let spawner = rt.spawner();
///
/// spawner.spawn(async { println!("hello"); });
/// ```
pub fn spawner(&self) -> Spawner {
let inner = self.inner().pool.spawner().clone();
Spawner::new(inner)
}
/// Signals the runtime to shutdown immediately.
///
/// Blocks the curr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | ed5a94eb2db95b7cc142045fbbd5d68c6276e04e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ed5a94eb2db95b7cc142045fbbd5d68c6276e04e/tokio/src/runtime/threadpool/mod.rs | 161 | 211 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:6 | ///
/// [mod]: index.html
#[allow(warnings)]
pub fn shutdown_now(mut self) {
self.inner.unwrap().pool.shutdown_now();
}
fn inner(&self) -> &Inner {
self.inner.as_ref().unwrap()
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | ed5a94eb2db95b7cc142045fbbd5d68c6276e04e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/ed5a94eb2db95b7cc142045fbbd5d68c6276e04e/tokio/src/runtime/threadpool/mod.rs | 201 | 211 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:1 | mod background;
mod builder;
mod task_executor;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::builder::Builder;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::task_executor::TaskExecutor;
use background::Background;
use tokio_execu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | d1f60ac4c69792211f9c9f3bcff1559bc0cb837a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f60ac4c69792211f9c9f3bcff1559bc0cb837a/tokio/src/runtime/threadpool/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:4 | ///
/// [mod]: index.html
///
/// # Examples
///
/// ```
/// use tokio::runtime::Runtime;
///
/// fn main() {
/// // Create the runtime
/// let rt = Runtime::new().unwrap();
///
/// // Spawn a future onto the runtime
/// rt.spawn(async {
/// pri... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | d1f60ac4c69792211f9c9f3bcff1559bc0cb837a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f60ac4c69792211f9c9f3bcff1559bc0cb837a/tokio/src/runtime/threadpool/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | /// # Panics
///
/// This function panics if the executor is at capacity, if the provided
/// future panics, or if called within an asynchronous execution context.
pub fn block_on<F>(&self, future: F) -> F::Output
where
F: Future,
{
let mut entered = enter().expect("nested block_... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | d1f60ac4c69792211f9c9f3bcff1559bc0cb837a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f60ac4c69792211f9c9f3bcff1559bc0cb837a/tokio/src/runtime/threadpool/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:7 | /// let rt = Runtime::new()
/// .unwrap();
///
/// // Use the runtime...
///
/// // Shutdown the runtime
/// rt.shutdown_now();
/// ```
///
/// [mod]: index.html
pub fn shutdown_now(mut self) {
let mut e = tokio_executor::enter().unwrap();
let inner = self.inn... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | d1f60ac4c69792211f9c9f3bcff1559bc0cb837a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/d1f60ac4c69792211f9c9f3bcff1559bc0cb837a/tokio/src/runtime/threadpool/mod.rs | 241 | 261 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:4 | /// See [module level][mod] documentation for more details.
///
/// [mod]: index.html
///
/// # Examples
///
/// ```
/// use tokio::runtime::Runtime;
///
/// fn main() {
/// // Create the runtime
/// let rt = Runtime::new().unwrap();
///
/// // Spawn a future... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | a791f4a758604768463d3ca2162b913dcea34c40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/src/runtime/threadpool/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | ///
/// # Panics
///
/// This function panics if the executor is at capacity, if the provided
/// future panics, or if called within an asynchronous execution context.
pub fn block_on<F>(&self, future: F) -> F::Output
where
F: Future,
{
let mut entered = enter().expect("neste... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | a791f4a758604768463d3ca2162b913dcea34c40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/src/runtime/threadpool/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:7 | /// use tokio::runtime::Runtime;
/// use tokio::prelude::*;
///
/// let rt = Runtime::new()
/// .unwrap();
///
/// // Use the runtime...
///
/// // Shutdown the runtime
/// rt.shutdown_now();
/// ```
///
/// [mod]: index.html
pub fn shutdown_now(mut self) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | a791f4a758604768463d3ca2162b913dcea34c40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/a791f4a758604768463d3ca2162b913dcea34c40/tokio/src/runtime/threadpool/mod.rs | 241 | 264 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:4 | /// See [module level][mod] documentation for more details.
///
/// [mod]: index.html
///
/// # Examples
///
/// ```
/// #![feature(async_await)]
///
/// use tokio::runtime::Runtime;
///
/// fn main() {
/// // Create the runtime
/// let rt = Runtime::new().unwra... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | f1f61a3b15d17767b12bfd8c0c5712db1b089b0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f1f61a3b15d17767b12bfd8c0c5712db1b089b0b/tokio/src/runtime/threadpool/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | ///
/// This method should not be called from an asynchronous context.
///
/// # Panics
///
/// This function panics if the executor is at capacity, if the provided
/// future panics, or if called within an asynchronous execution context.
pub fn block_on<F>(&self, future: F) -> F::Output
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | f1f61a3b15d17767b12bfd8c0c5712db1b089b0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f1f61a3b15d17767b12bfd8c0c5712db1b089b0b/tokio/src/runtime/threadpool/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:7 | ///
/// ```
/// use tokio::runtime::Runtime;
/// use tokio::prelude::*;
///
/// let rt = Runtime::new()
/// .unwrap();
///
/// // Use the runtime...
///
/// // Shutdown the runtime
/// rt.shutdown_now();
/// ```
///
/// [mod]: index.html
pub fn shutdown_no... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | f1f61a3b15d17767b12bfd8c0c5712db1b089b0b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/f1f61a3b15d17767b12bfd8c0c5712db1b089b0b/tokio/src/runtime/threadpool/mod.rs | 241 | 266 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:1 | mod background;
mod builder;
mod task_executor;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::builder::Builder;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::task_executor::TaskExecutor;
use background::Background;
use tokio_execu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 3b27dc31d28df93fcc65ed3b744033d4ad4f77cc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b27dc31d28df93fcc65ed3b744033d4ad4f77cc/tokio/src/runtime/threadpool/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:4 | ///
/// [mod]: index.html
///
/// # Examples
///
/// ```
/// #![feature(async_await)]
///
/// use tokio::runtime::Runtime;
///
/// fn main() {
/// // Create the runtime
/// let rt = Runtime::new().unwrap();
///
/// // Spawn a future onto the runtime
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 3b27dc31d28df93fcc65ed3b744033d4ad4f77cc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b27dc31d28df93fcc65ed3b744033d4ad4f77cc/tokio/src/runtime/threadpool/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | /// This method should not be called from an asynchronous context.
///
/// # Panics
///
/// This function panics if the executor is at capacity, if the provided
/// future panics, or if called within an asynchronous execution context.
pub fn block_on<F>(&self, future: F) -> F::Output
where
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 3b27dc31d28df93fcc65ed3b744033d4ad4f77cc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b27dc31d28df93fcc65ed3b744033d4ad4f77cc/tokio/src/runtime/threadpool/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:7 | /// ```
/// use tokio::runtime::Runtime;
/// use tokio::prelude::*;
///
/// let rt = Runtime::new()
/// .unwrap();
///
/// // Use the runtime...
///
/// // Shutdown the runtime
/// rt.shutdown_now();
/// ```
///
/// [mod]: index.html
pub fn shutdown_now(mut se... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 3b27dc31d28df93fcc65ed3b744033d4ad4f77cc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b27dc31d28df93fcc65ed3b744033d4ad4f77cc/tokio/src/runtime/threadpool/mod.rs | 241 | 265 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:1 | mod background;
mod builder;
mod task_executor;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::builder::Builder;
#[allow(unreachable_pub)] // https://github.com/rust-lang/rust/issues/57411
pub use self::task_executor::TaskExecutor;
use background::Background;
use tokio_execu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 37131b21144de133628b54a1de500b623058f8cf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37131b21144de133628b54a1de500b623058f8cf/tokio/src/runtime/threadpool/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:4 | /// [mod]: index.html
///
/// # Examples
///
/// ```
/// #![feature(async_await)]
///
/// use tokio::runtime::Runtime;
///
/// fn main() {
/// // Create the runtime
/// let rt = Runtime::new().unwrap();
///
/// // Spawn a future onto the runtime
/// rt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 37131b21144de133628b54a1de500b623058f8cf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37131b21144de133628b54a1de500b623058f8cf/tokio/src/runtime/threadpool/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | ///
/// # Panics
///
/// This function panics if the executor is at capacity, if the provided
/// future panics, or if called within an asynchronous execution context.
pub fn block_on<F>(&self, future: F) -> F::Output
where
F: Future,
{
let mut entered = enter().expect("neste... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 37131b21144de133628b54a1de500b623058f8cf | github | async-runtime | https://github.com/tokio-rs/tokio/blob/37131b21144de133628b54a1de500b623058f8cf/tokio/src/runtime/threadpool/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:4 | /// [mod]: index.html
///
/// # Examples
///
/// ```
/// #![feature(async_await)]
///
/// use tokio::runtime::Runtime;
///
/// fn main() {
/// // Create the runtime
/// let rt = Runtime::new().unwrap();
///
/// // Spawn a future onto the runtime
/// rt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 8538c25170240fa46313ffe9d4a9a2f9ba2536e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8538c25170240fa46313ffe9d4a9a2f9ba2536e5/tokio/src/runtime/threadpool/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | ///
/// # Panics
///
/// This function panics if the executor is at capacity, if the provided
/// future panics, or if called within an asynchronous execution context.
pub fn block_on<F>(&self, future: F) -> F::Output
where
F: Future,
{
let mut entered = enter().expect("neste... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 8538c25170240fa46313ffe9d4a9a2f9ba2536e5 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8538c25170240fa46313ffe9d4a9a2f9ba2536e5/tokio/src/runtime/threadpool/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:4 | /// [mod]: index.html
///
/// # Examples
///
/// ```
/// #![feature(async_await)]
///
/// use tokio::runtime::Runtime;
///
/// fn main() {
/// // Create the runtime
/// let rt = Runtime::new().unwrap();
///
/// // Spawn a future onto the runtime
/// rt... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 6a125082e48c6e2334d64e4ebc5b6a988cf27b3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6a125082e48c6e2334d64e4ebc5b6a988cf27b3f/tokio/src/runtime/threadpool/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | ///
/// # Panics
///
/// This function panics if the executor is at capacity, if the provided
/// future panics, or if called within an asynchronous execution context.
pub fn block_on<F>(&self, future: F) -> F::Output
where
F: Future,
{
let mut entered = enter().expect("neste... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 6a125082e48c6e2334d64e4ebc5b6a988cf27b3f | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6a125082e48c6e2334d64e4ebc5b6a988cf27b3f/tokio/src/runtime/threadpool/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:1 | mod background;
mod builder;
mod task_executor;
pub use self::builder::Builder;
pub use self::task_executor::TaskExecutor;
use background::Background;
use tokio_executor::enter;
use tokio_timer::timer;
use tracing_core as trace;
use std::future::Future;
use std::io;
/// Handle to the Tokio runtime.
///
/// The Toki... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 47e2ff48d9f1daac7dba9f136b24eed64c87cf40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47e2ff48d9f1daac7dba9f136b24eed64c87cf40/tokio/src/runtime/threadpool/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:4 | /// # Examples
///
/// ```
/// #![feature(async_await)]
///
/// use tokio::runtime::Runtime;
///
/// fn main() {
/// // Create the runtime
/// let rt = Runtime::new().unwrap();
///
/// // Spawn a future onto the runtime
/// rt.spawn(async {
/// prin... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 47e2ff48d9f1daac7dba9f136b24eed64c87cf40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47e2ff48d9f1daac7dba9f136b24eed64c87cf40/tokio/src/runtime/threadpool/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | ///
/// This function panics if the executor is at capacity, if the provided
/// future panics, or if called within an asynchronous execution context.
pub fn block_on<F>(&self, future: F) -> F::Output
where
F: Future,
{
let mut entered = enter().expect("nested block_on");
le... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 47e2ff48d9f1daac7dba9f136b24eed64c87cf40 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/47e2ff48d9f1daac7dba9f136b24eed64c87cf40/tokio/src/runtime/threadpool/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:4 | ///
/// # Examples
///
/// ```rust
/// # use futures::{future, Future, Stream};
/// use tokio::runtime::Runtime;
///
/// # fn dox() {
/// // Create the runtime
/// let rt = Runtime::new().unwrap();
///
/// // Spawn a future onto the runtime
/// rt.spawn(future::lazy(|| {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8/tokio/src/runtime/threadpool/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | ///
/// This function panics if the executor is at capacity, if the provided
/// future panics, or if called within an asynchronous execution context.
pub fn block_on<F>(&self, future: F) -> F::Output
where
F: Future,
{
let mut entered = enter().expect("nested block_on");
le... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8/tokio/src/runtime/threadpool/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:7 | /// # Examples
///
/// ```
/// use tokio::runtime::Runtime;
/// use tokio::prelude::*;
///
/// let rt = Runtime::new()
/// .unwrap();
///
/// // Use the runtime...
///
/// // Shutdown the runtime
/// rt.shutdown_now()
/// .wait().unwrap();
/// ```
///
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/9d3e5aac083fd7369bcc48b7f75472b6f8f87ea8/tokio/src/runtime/threadpool/mod.rs | 241 | 266 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:1 | mod builder;
mod shutdown;
mod task_executor;
pub use self::builder::Builder;
pub use self::shutdown::Shutdown;
pub use self::task_executor::TaskExecutor;
use crate::reactor::{Handle, Reactor};
use futures;
use futures::future::Future;
use tokio_executor::enter;
use tokio_threadpool as threadpool;
use std::io;
use st... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 06c473e62842d257ed275497ce906710ea3f8e19 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06c473e62842d257ed275497ce906710ea3f8e19/tokio/src/runtime/threadpool/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:3 | /// });
///
/// tokio::run(server);
/// # }
/// # pub fn main() {}
/// ```
///
/// # Panics
///
/// This function panics if called from the context of an executor.
///
/// [mod]: ../index.html
pub fn run<F>(future: F)
where F: Future<Item = (), Error = ()> + Send + 'static,
{
// Check enter before creating a ne... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 06c473e62842d257ed275497ce906710ea3f8e19 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06c473e62842d257ed275497ce906710ea3f8e19/tokio/src/runtime/threadpool/mod.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:4 | /// ```
/// use tokio::runtime::Runtime;
/// use tokio::prelude::*;
///
/// let rt = Runtime::new()
/// .unwrap();
///
/// // Use the runtime...
///
/// // Shutdown the runtime
/// rt.shutdown_now()
/// .wait().unwrap();
/// ```
///
/// [mod]: index.html
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 06c473e62842d257ed275497ce906710ea3f8e19 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06c473e62842d257ed275497ce906710ea3f8e19/tokio/src/runtime/threadpool/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | /// let reactor_handle = rt.reactor().clone();
///
/// // use `reactor_handle`
/// ```
#[deprecated(since = "0.1.11", note = "there is now a reactor per worker thread")]
pub fn reactor(&self) -> &Handle {
let mut reactor = self.inner().reactor.lock().unwrap();
if let Some(reactor) = ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 06c473e62842d257ed275497ce906710ea3f8e19 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06c473e62842d257ed275497ce906710ea3f8e19/tokio/src/runtime/threadpool/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:6 | /// thread pool. The thread pool is then responsible for polling the future
/// until it completes.
///
/// See [module level][mod] documentation for more details.
///
/// [mod]: index.html
///
/// # Examples
///
/// ```rust
/// # use futures::{future, Future, Stream};
/// us... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 06c473e62842d257ed275497ce906710ea3f8e19 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06c473e62842d257ed275497ce906710ea3f8e19/tokio/src/runtime/threadpool/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:7 | /// complete, and yielding its resolved result. Any tasks or timers which
/// the future spawns internally will be executed on the runtime.
///
/// This method should not be called from an asynchronous context.
///
/// # Panics
///
/// This function panics if the executor is at capacity, if ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 06c473e62842d257ed275497ce906710ea3f8e19 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06c473e62842d257ed275497ce906710ea3f8e19/tokio/src/runtime/threadpool/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:8 | {
let mut entered = enter().expect("nested block_on_all");
let (tx, rx) = futures::sync::oneshot::channel();
self.spawn(future.then(move |r| tx.send(r).map_err(|_| unreachable!())));
let block = rx
.map_err(|_| panic!("blocked on future paniced"))
.and_then(move |... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 06c473e62842d257ed275497ce906710ea3f8e19 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06c473e62842d257ed275497ce906710ea3f8e19/tokio/src/runtime/threadpool/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:9 | /// rt.shutdown_on_idle()
/// .wait().unwrap();
/// ```
///
/// [mod]: index.html
pub fn shutdown_on_idle(mut self) -> Shutdown {
let inner = self.inner.take().unwrap();
let inner = inner.pool.shutdown_on_idle();
Shutdown { inner }
}
/// Signals the runtime to sh... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 06c473e62842d257ed275497ce906710ea3f8e19 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06c473e62842d257ed275497ce906710ea3f8e19/tokio/src/runtime/threadpool/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:10 | /// // Shutdown the runtime
/// rt.shutdown_now()
/// .wait().unwrap();
/// ```
///
/// [mod]: index.html
pub fn shutdown_now(mut self) -> Shutdown {
let inner = self.inner.take().unwrap();
Shutdown::shutdown_now(inner)
}
fn inner(&self) -> &Inner {
self.inne... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 06c473e62842d257ed275497ce906710ea3f8e19 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/06c473e62842d257ed275497ce906710ea3f8e19/tokio/src/runtime/threadpool/mod.rs | 361 | 384 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:1 | mod builder;
mod shutdown;
mod task_executor;
#[cfg(feature = "async-await-preview")]
mod async_await;
pub use self::builder::Builder;
pub use self::shutdown::Shutdown;
pub use self::task_executor::TaskExecutor;
use crate::reactor::{Handle, Reactor};
use futures;
use futures::future::Future;
use tokio_executor::ente... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 2ac132fb4652901a1a61b5bf7a701056ef7761ea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ac132fb4652901a1a61b5bf7a701056ef7761ea/tokio/src/runtime/threadpool/mod.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:4 | ///
/// Creating a new `Runtime` with default configuration values.
///
/// ```
/// use tokio::runtime::Runtime;
/// use tokio::prelude::*;
///
/// let rt = Runtime::new()
/// .unwrap();
///
/// // Use the runtime...
///
/// // Shutdown the runtime
/// rt.shutdown... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 2ac132fb4652901a1a61b5bf7a701056ef7761ea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ac132fb4652901a1a61b5bf7a701056ef7761ea/tokio/src/runtime/threadpool/mod.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | /// let rt = Runtime::new()
/// .unwrap();
///
/// let reactor_handle = rt.reactor().clone();
///
/// // use `reactor_handle`
/// ```
#[deprecated(since = "0.1.11", note = "there is now a reactor per worker thread")]
pub fn reactor(&self) -> &Handle {
let mut reactor = self.i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 2ac132fb4652901a1a61b5bf7a701056ef7761ea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ac132fb4652901a1a61b5bf7a701056ef7761ea/tokio/src/runtime/threadpool/mod.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:6 | /// Spawn a future onto the Tokio runtime.
///
/// This spawns the given future onto the runtime's executor, usually a
/// thread pool. The thread pool is then responsible for polling the future
/// until it completes.
///
/// See [module level][mod] documentation for more details.
///
/... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 2ac132fb4652901a1a61b5bf7a701056ef7761ea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ac132fb4652901a1a61b5bf7a701056ef7761ea/tokio/src/runtime/threadpool/mod.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:7 | /// Run a future to completion on the Tokio runtime.
///
/// This runs the given future on the runtime, blocking until it is
/// complete, and yielding its resolved result. Any tasks or timers which
/// the future spawns internally will be executed on the runtime.
///
/// This method should not ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 2ac132fb4652901a1a61b5bf7a701056ef7761ea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ac132fb4652901a1a61b5bf7a701056ef7761ea/tokio/src/runtime/threadpool/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:8 | F: Send + 'static + Future<Item = R, Error = E>,
R: Send + 'static,
E: Send + 'static,
{
let mut entered = enter().expect("nested block_on_all");
let (tx, rx) = futures::sync::oneshot::channel();
self.spawn(future.then(move |r| tx.send(r).map_err(|_| unreachable!())));
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 2ac132fb4652901a1a61b5bf7a701056ef7761ea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ac132fb4652901a1a61b5bf7a701056ef7761ea/tokio/src/runtime/threadpool/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:9 | /// // Use the runtime...
///
/// // Shutdown the runtime
/// rt.shutdown_on_idle()
/// .wait().unwrap();
/// ```
///
/// [mod]: index.html
pub fn shutdown_on_idle(mut self) -> Shutdown {
let inner = self.inner.take().unwrap();
let inner = inner.pool.shutdown_on_idle(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 2ac132fb4652901a1a61b5bf7a701056ef7761ea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ac132fb4652901a1a61b5bf7a701056ef7761ea/tokio/src/runtime/threadpool/mod.rs | 321 | 380 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:10 | ///
/// // Use the runtime...
///
/// // Shutdown the runtime
/// rt.shutdown_now()
/// .wait().unwrap();
/// ```
///
/// [mod]: index.html
pub fn shutdown_now(mut self) -> Shutdown {
let inner = self.inner.take().unwrap();
Shutdown::shutdown_now(inner)
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 2ac132fb4652901a1a61b5bf7a701056ef7761ea | github | async-runtime | https://github.com/tokio-rs/tokio/blob/2ac132fb4652901a1a61b5bf7a701056ef7761ea/tokio/src/runtime/threadpool/mod.rs | 361 | 387 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:7 | /// Run a future to completion on the Tokio runtime.
///
/// This runs the given future on the runtime, blocking until it is
/// complete, and yielding its resolved result. Any tasks or timers which
/// the future spawns internally will be executed on the runtime.
///
/// This method should not ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/src/runtime/threadpool/mod.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:8 | F: Send + 'static + Future<Item = R, Error = E>,
R: Send + 'static,
E: Send + 'static,
{
let mut entered = enter().expect("nested block_on_all");
let (tx, rx) = futures::sync::oneshot::channel();
self.spawn(future.then(move |r| tx.send(r).map_err(|_| unreachable!())));
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 4f6395b31c2e5e550188c8ae01de2c4eaee2937b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/4f6395b31c2e5e550188c8ae01de2c4eaee2937b/tokio/src/runtime/threadpool/mod.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/threadpool/mod.rs:5 | /// let rt = Runtime::new()
/// .unwrap();
///
/// let reactor_handle = rt.reactor().clone();
///
/// // use `reactor_handle`
/// ```
#[deprecated(since = "0.1.11", note = "there is now a reactor per worker thread")]
pub fn reactor(&self) -> &Handle {
let mut reactor = self.i... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/threadpool/mod.rs | MIT | 5c0b56278b95a16f2f0b6dedfffe730b39d52948 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/5c0b56278b95a16f2f0b6dedfffe730b39d52948/tokio/src/runtime/threadpool/mod.rs | 161 | 220 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.