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/current_thread/runtime.rs:3 | T: Future<Item = (), Error = ()> + Send + 'static,
{
fn spawn(&mut self, future: T) -> Result<(), ::executor::SpawnError> {
Handle::spawn(self, future)
}
}
/// Error returned by the `run` function.
#[derive(Debug)]
pub struct RunError {
inner: current_thread::RunError,
}
impl fmt::Display for RunE... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/current_thread/runtime.rs | MIT | b1172f8074b381b543ff15e23e3092fc5dc6de7d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b1172f8074b381b543ff15e23e3092fc5dc6de7d/tokio/src/runtime/current_thread/runtime.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/current_thread/runtime.rs:4 | timer_handle: timer::Handle,
clock: Clock,
executor: CurrentThread<Timer<Reactor>>) -> Runtime
{
Runtime {
reactor_handle,
timer_handle,
clock,
executor,
}
}
/// Get a new handle to spawn futures on the single-threaded Tokio ru... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/current_thread/runtime.rs | MIT | b1172f8074b381b543ff15e23e3092fc5dc6de7d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b1172f8074b381b543ff15e23e3092fc5dc6de7d/tokio/src/runtime/current_thread/runtime.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/current_thread/runtime.rs:5 | /// println!("running on the runtime");
/// Ok(())
/// }));
/// # }
/// # pub fn main() {}
/// ```
///
/// # Panics
///
/// This function panics if the spawn fails. Failure occurs if the executor
/// is currently at capacity and is unable to spawn a new future.
pub fn... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/current_thread/runtime.rs | MIT | b1172f8074b381b543ff15e23e3092fc5dc6de7d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b1172f8074b381b543ff15e23e3092fc5dc6de7d/tokio/src/runtime/current_thread/runtime.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/current_thread/runtime.rs:6 | ret.map_err(|e| e.into_inner().expect("unexpected execution error"))
})
}
/// Run the executor to completion, blocking the thread until **all**
/// spawned futures have completed.
pub fn run(&mut self) -> Result<(), RunError> {
self.enter(|executor| executor.run())
.map_err(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/current_thread/runtime.rs | MIT | b1172f8074b381b543ff15e23e3092fc5dc6de7d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/b1172f8074b381b543ff15e23e3092fc5dc6de7d/tokio/src/runtime/current_thread/runtime.rs | 201 | 247 |
tokio-rs/tokio:tokio/src/runtime/defer.rs:1 | use std::task::Waker;
pub(crate) struct Defer {
deferred: Vec<Waker>,
}
impl Defer {
pub(crate) fn new() -> Defer {
Defer {
deferred: Default::default(),
}
}
pub(crate) fn defer(&mut self, waker: &Waker) {
// If the same task adds itself a bunch of times, then only... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/defer.rs | MIT | 7430865d655d31836ce62e65d8f03bcb9a85b12e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7430865d655d31836ce62e65d8f03bcb9a85b12e/tokio/src/runtime/defer.rs | 1 | 38 |
tokio-rs/tokio:tokio/src/runtime/defer.rs:1 | use std::task::Waker;
pub(crate) struct Defer {
deferred: Vec<Waker>,
}
impl Defer {
pub(crate) fn new() -> Defer {
Defer {
deferred: Default::default(),
}
}
pub(crate) fn defer(&mut self, waker: Waker) {
self.deferred.push(waker);
}
pub(crate) fn is_empty... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/defer.rs | MIT | 22862739dddd49a94065aa7a917cde2dc8a3f6bc | github | async-runtime | https://github.com/tokio-rs/tokio/blob/22862739dddd49a94065aa7a917cde2dc8a3f6bc/tokio/src/runtime/defer.rs | 1 | 27 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:1 | //! Abstracts out the entire chain of runtime sub-drivers into common types.
// Eventually, this file will see significant refactoring / cleanup. For now, we
// don't need to worry much about dead code with certain feature permutations.
#![cfg_attr(
any(not(all(tokio_unstable, feature = "full")), target_family = "... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:2 | pub(crate) start_paused: bool,
pub(crate) nevents: usize,
pub(crate) timer_flavor: crate::runtime::TimerFlavor,
}
impl Driver {
pub(crate) fn new(cfg: Cfg) -> io::Result<(Self, Handle)> {
let (io_stack, io_handle, signal_handle) = create_io_stack(cfg.enable_io, cfg.nevents)?;
let clock = c... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:3 | #[cfg(feature = "time")]
if let Some(handle) = &self.time {
handle.unpark();
}
self.io.unpark();
}
cfg_io_driver! {
#[track_caller]
pub(crate) fn io(&self) -> &crate::runtime::io::Handle {
self.io
.as_ref()
.expect... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:4 | F: FnOnce(Option<&crate::runtime::time::Handle>) -> R,
{
f(self.time.as_ref())
}
pub(crate) fn clock(&self) -> &Clock {
&self.clock
}
}
}
// ===== io driver =====
cfg_io_driver! {
pub(crate) type IoDriver = crate::runtime::io::Driver;
#[derive(Debu... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:5 | let park_thread = ParkThread::new();
let unpark_thread = park_thread.unpark();
(IoStack::Disabled(park_thread), IoHandle::Disabled(unpark_thread), Default::default())
};
Ok(ret)
}
impl IoStack {
pub(crate) fn park(&mut self, handle: &Handle) {
match ... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/driver.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:6 | match self {
IoHandle::Enabled(v) => Some(v),
IoHandle::Disabled(..) => None,
}
}
}
}
cfg_not_io_driver! {
pub(crate) type IoHandle = UnparkThread;
#[derive(Debug)]
pub(crate) struct IoStack(ParkThread);
fn create_io_stack(_enabled: bool, _neven... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/driver.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:7 | // ===== signal driver =====
cfg_signal_internal_and_unix! {
type SignalDriver = crate::runtime::signal::Driver;
pub(crate) type SignalHandle = Option<crate::runtime::signal::Handle>;
fn create_signal_driver(io_driver: IoDriver, io_handle: &crate::runtime::io::Handle) -> io::Result<(SignalDriver, SignalHa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/driver.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:8 | signal_driver
}
}
}
// ===== time driver =====
cfg_time! {
#[derive(Debug)]
pub(crate) enum TimeDriver {
Enabled {
driver: crate::runtime::time::Driver,
},
EnabledAlt(IoStack),
Disabled(IoStack),
}
pub(crate) type Clock = crate::time::Clock;
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/driver.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:9 | }
} else {
(TimeDriver::Disabled(io_stack), None)
}
}
impl TimeDriver {
pub(crate) fn park(&mut self, handle: &Handle) {
match self {
TimeDriver::Enabled { driver, .. } => driver.park(handle),
TimeDriver::EnabledAlt(v) => v.park(ha... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/driver.rs | 321 | 376 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:10 | ()
}
fn create_time_driver(
_enable: bool,
_timer_flavor: crate::runtime::TimerFlavor,
io_stack: IoStack,
_clock: &Clock,
) -> (TimeDriver, TimeHandle) {
(io_stack, ())
}
}
cfg_io_uring! {
pub(crate) mod op;
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/driver.rs | 361 | 376 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:1 | //! Abstracts out the entire chain of runtime sub-drivers into common types.
// Eventually, this file will see significant refactoring / cleanup. For now, we
// don't need to worry much about dead code with certain feature permutations.
#![cfg_attr(
any(not(all(tokio_unstable, feature = "full")), target_family = "... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a/tokio/src/runtime/driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:2 | pub(crate) start_paused: bool,
pub(crate) nevents: usize,
}
impl Driver {
pub(crate) fn new(cfg: Cfg) -> io::Result<(Self, Handle)> {
let (io_stack, io_handle, signal_handle) = create_io_stack(cfg.enable_io, cfg.nevents)?;
let clock = create_clock(cfg.enable_pause_time, cfg.start_paused);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a/tokio/src/runtime/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:3 | handle.unpark();
}
self.io.unpark();
}
cfg_io_driver! {
#[track_caller]
pub(crate) fn io(&self) -> &crate::runtime::io::Handle {
self.io
.as_ref()
.expect("A Tokio 1.x context was found, but IO is disabled. Call `enable_io` on the run... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a/tokio/src/runtime/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:4 | // ===== io driver =====
cfg_io_driver! {
pub(crate) type IoDriver = crate::runtime::io::Driver;
#[derive(Debug)]
pub(crate) enum IoStack {
Enabled(ProcessDriver),
Disabled(ParkThread),
}
#[derive(Debug)]
pub(crate) enum IoHandle {
Enabled(crate::runtime::io::Handle),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a/tokio/src/runtime/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:5 | match self {
IoStack::Enabled(v) => v.park(handle),
IoStack::Disabled(v) => v.park(),
}
}
pub(crate) fn park_timeout(&mut self, handle: &Handle, duration: Duration) {
match self {
IoStack::Enabled(v) => v.park_timeout(handle, durat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a/tokio/src/runtime/driver.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:6 | #[derive(Debug)]
pub(crate) struct IoStack(ParkThread);
fn create_io_stack(_enabled: bool, _nevents: usize) -> io::Result<(IoStack, IoHandle, SignalHandle)> {
let park_thread = ParkThread::new();
let unpark_thread = park_thread.unpark();
Ok((IoStack(park_thread), unpark_thread, Default:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a/tokio/src/runtime/driver.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:7 | }
}
cfg_not_signal_internal! {
pub(crate) type SignalHandle = ();
cfg_io_driver! {
type SignalDriver = IoDriver;
fn create_signal_driver(io_driver: IoDriver, _io_handle: &crate::runtime::io::Handle) -> io::Result<(SignalDriver, SignalHandle)> {
Ok((io_driver, ()))
}
}
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a/tokio/src/runtime/driver.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:8 | Enabled {
driver: crate::runtime::time::Driver,
},
Disabled(IoStack),
}
pub(crate) type Clock = crate::time::Clock;
pub(crate) type TimeHandle = Option<crate::runtime::time::Handle>;
fn create_clock(enable_pausing: bool, start_paused: bool) -> Clock {
crate::time::C... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a/tokio/src/runtime/driver.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:9 | }
pub(crate) fn shutdown(&mut self, handle: &Handle) {
match self {
TimeDriver::Enabled { driver } => driver.shutdown(handle),
TimeDriver::Disabled(v) => v.shutdown(handle),
}
}
}
}
cfg_not_time! {
type TimeDriver = IoStack;
pub(crat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a | github | async-runtime | https://github.com/tokio-rs/tokio/blob/3b5a15dfdfc5dc789dcb80cef0986fb2fa5cac0a/tokio/src/runtime/driver.rs | 321 | 353 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:9 | }
pub(crate) fn shutdown(&mut self, handle: &Handle) {
match self {
TimeDriver::Enabled { driver } => driver.shutdown(handle),
TimeDriver::Disabled(v) => v.shutdown(handle),
}
}
}
}
cfg_not_time! {
type TimeDriver = IoStack;
pub(crat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 327bec2caf92af5e2732f8fdfe2e4a20d349f67e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/327bec2caf92af5e2732f8fdfe2e4a20d349f67e/tokio/src/runtime/driver.rs | 321 | 353 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:9 | }
pub(crate) fn shutdown(&mut self, handle: &Handle) {
match self {
TimeDriver::Enabled { driver } => driver.shutdown(handle),
TimeDriver::Disabled(v) => v.shutdown(handle),
}
}
}
}
cfg_not_time! {
type TimeDriver = IoStack;
pub(crat... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1ae9434e8e4a419ce25644e6c8d2b2e2e8c34750/tokio/src/runtime/driver.rs | 321 | 349 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:1 | //! Abstracts out the entire chain of runtime sub-drivers into common types.
// Eventually, this file will see significant refactoring / cleanup. For now, we
// don't need to worry much about dead code with certain feature permutations.
#![cfg_attr(
any(not(all(tokio_unstable, feature = "full")), target_family = "... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 159a3b2c8587cd12ad54eb16489dad6eb674d4ca | github | async-runtime | https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:2 | pub(crate) start_paused: bool,
pub(crate) nevents: usize,
pub(crate) workers: usize,
}
impl Driver {
pub(crate) fn new(cfg: Cfg) -> io::Result<(Self, Handle)> {
let (io_stack, io_handle, signal_handle) = create_io_stack(cfg.enable_io, cfg.nevents)?;
let clock = create_clock(cfg.enable_paus... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 159a3b2c8587cd12ad54eb16489dad6eb674d4ca | github | async-runtime | https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:3 | #[cfg(feature = "time")]
if let Some(handle) = &self.time {
handle.unpark();
}
self.io.unpark();
}
cfg_io_driver! {
#[track_caller]
pub(crate) fn io(&self) -> &crate::runtime::io::Handle {
self.io
.as_ref()
.expect... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 159a3b2c8587cd12ad54eb16489dad6eb674d4ca | github | async-runtime | https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:4 | }
}
// ===== io driver =====
cfg_io_driver! {
pub(crate) type IoDriver = crate::runtime::io::Driver;
#[derive(Debug)]
pub(crate) enum IoStack {
Enabled(ProcessDriver),
Disabled(ParkThread),
}
#[derive(Debug)]
pub(crate) enum IoHandle {
Enabled(crate::runtime::io::Hand... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 159a3b2c8587cd12ad54eb16489dad6eb674d4ca | github | async-runtime | https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:5 | impl IoStack {
pub(crate) fn park(&mut self, handle: &Handle) {
match self {
IoStack::Enabled(v) => v.park(handle),
IoStack::Disabled(v) => v.park(),
}
}
pub(crate) fn park_timeout(&mut self, handle: &Handle, duration: Duration) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 159a3b2c8587cd12ad54eb16489dad6eb674d4ca | github | async-runtime | https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/driver.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:6 | cfg_not_io_driver! {
pub(crate) type IoHandle = UnparkThread;
#[derive(Debug)]
pub(crate) struct IoStack(ParkThread);
fn create_io_stack(_enabled: bool, _nevents: usize) -> io::Result<(IoStack, IoHandle, SignalHandle)> {
let park_thread = ParkThread::new();
let unpark_thread = park_thr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 159a3b2c8587cd12ad54eb16489dad6eb674d4ca | github | async-runtime | https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/driver.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:7 | let handle = driver.handle();
Ok((driver, Some(handle)))
}
}
cfg_not_signal_internal! {
pub(crate) type SignalHandle = ();
cfg_io_driver! {
type SignalDriver = IoDriver;
fn create_signal_driver(io_driver: IoDriver, _io_handle: &crate::runtime::io::Handle) -> io::Result<(SignalDriv... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 159a3b2c8587cd12ad54eb16489dad6eb674d4ca | github | async-runtime | https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/driver.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:8 | #[derive(Debug)]
pub(crate) enum TimeDriver {
Enabled {
driver: crate::runtime::time::Driver,
},
Disabled(IoStack),
}
pub(crate) type Clock = crate::time::Clock;
pub(crate) type TimeHandle = Option<crate::runtime::time::Handle>;
fn create_clock(enable_pausing: b... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 159a3b2c8587cd12ad54eb16489dad6eb674d4ca | github | async-runtime | https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/driver.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:9 | TimeDriver::Enabled { driver } => driver.park_timeout(handle, duration),
TimeDriver::Disabled(v) => v.park_timeout(handle, duration),
}
}
pub(crate) fn shutdown(&mut self, handle: &Handle) {
match self {
TimeDriver::Enabled { driver } => driver.sh... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 159a3b2c8587cd12ad54eb16489dad6eb674d4ca | github | async-runtime | https://github.com/tokio-rs/tokio/blob/159a3b2c8587cd12ad54eb16489dad6eb674d4ca/tokio/src/runtime/driver.rs | 321 | 353 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:2 | pub(crate) start_paused: bool,
pub(crate) nevents: usize,
pub(crate) workers: usize,
}
impl Driver {
pub(crate) fn new(cfg: Cfg) -> io::Result<(Self, Handle)> {
let (io_stack, io_handle, signal_handle) = create_io_stack(cfg.enable_io, cfg.nevents)?;
let clock = create_clock(cfg.enable_paus... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210/tokio/src/runtime/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:3 | }
impl Handle {
pub(crate) fn unpark(&self) {
#[cfg(feature = "time")]
if let Some(handle) = &self.time {
handle.unpark();
}
self.io.unpark();
}
cfg_io_driver! {
#[track_caller]
pub(crate) fn io(&self) -> &crate::runtime::io::Handle {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210/tokio/src/runtime/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:4 | pub(crate) fn clock(&self) -> &Clock {
&self.clock
}
}
}
// ===== io driver =====
cfg_io_driver! {
pub(crate) type IoDriver = crate::runtime::io::Driver;
#[derive(Debug)]
pub(crate) enum IoStack {
Enabled(ProcessDriver),
Disabled(ParkThread),
}
#[derive(De... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210/tokio/src/runtime/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:5 | Ok(ret)
}
impl IoStack {
pub(crate) fn is_enabled(&self) -> bool {
match self {
IoStack::Enabled(..) => true,
IoStack::Disabled(..) => false,
}
}
pub(crate) fn park(&mut self, handle: &Handle) {
match self {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210/tokio/src/runtime/driver.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:6 | }
pub(crate) fn as_ref(&self) -> Option<&crate::runtime::io::Handle> {
match self {
IoHandle::Enabled(v) => Some(v),
IoHandle::Disabled(..) => None,
}
}
}
}
cfg_not_io_driver! {
pub(crate) type IoHandle = UnparkThread;
#[derive(Debug... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210/tokio/src/runtime/driver.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:7 | }
}
// ===== signal driver =====
cfg_signal_internal_and_unix! {
type SignalDriver = crate::runtime::signal::Driver;
pub(crate) type SignalHandle = Option<crate::runtime::signal::Handle>;
fn create_signal_driver(io_driver: IoDriver, io_handle: &crate::runtime::io::Handle) -> io::Result<(SignalDriver, Sig... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210/tokio/src/runtime/driver.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:8 | type ProcessDriver = SignalDriver;
fn create_process_driver(signal_driver: SignalDriver) -> ProcessDriver {
signal_driver
}
}
}
// ===== time driver =====
cfg_time! {
#[derive(Debug)]
pub(crate) enum TimeDriver {
Enabled {
driver: crate::runtime::time::Driv... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210/tokio/src/runtime/driver.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:9 | impl TimeDriver {
pub(crate) fn is_enabled(&self) -> bool {
match self {
TimeDriver::Enabled { .. } => true,
TimeDriver::Disabled(inner) => inner.is_enabled(),
}
}
pub(crate) fn park(&mut self, handle: &Handle) {
match self {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210/tokio/src/runtime/driver.rs | 321 | 371 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:10 | }
fn create_time_driver(
_enable: bool,
io_stack: IoStack,
_clock: &Clock,
_workers: usize,
) -> (TimeDriver, TimeHandle) {
(io_stack, ())
}
} | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/1914e1e4b9bfe6ea2d61970ec3fcf2b5d7bb0210/tokio/src/runtime/driver.rs | 361 | 371 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:2 | pub(crate) start_paused: bool,
pub(crate) nevents: usize,
}
impl Driver {
pub(crate) fn new(cfg: Cfg) -> io::Result<(Self, Handle)> {
let (io_stack, io_handle, signal_handle) = create_io_stack(cfg.enable_io, cfg.nevents)?;
let clock = create_clock(cfg.enable_pause_time, cfg.start_paused);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:3 | impl Handle {
pub(crate) fn unpark(&self) {
#[cfg(feature = "time")]
if let Some(handle) = &self.time {
handle.unpark();
}
self.io.unpark();
}
cfg_io_driver! {
#[track_caller]
pub(crate) fn io(&self) -> &crate::runtime::io::Handle {
s... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:4 | &self.clock
}
}
}
// ===== io driver =====
cfg_io_driver! {
pub(crate) type IoDriver = crate::runtime::io::Driver;
#[derive(Debug)]
pub(crate) enum IoStack {
Enabled(ProcessDriver),
Disabled(ParkThread),
}
#[derive(Debug)]
pub(crate) enum IoHandle {
Enable... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:5 | }
impl IoStack {
pub(crate) fn is_enabled(&self) -> bool {
match self {
IoStack::Enabled(..) => true,
IoStack::Disabled(..) => false,
}
}
pub(crate) fn park(&mut self, handle: &Handle) {
match self {
IoStac... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/driver.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:6 | pub(crate) fn as_ref(&self) -> Option<&crate::runtime::io::Handle> {
match self {
IoHandle::Enabled(v) => Some(v),
IoHandle::Disabled(..) => None,
}
}
}
}
cfg_not_io_driver! {
pub(crate) type IoHandle = UnparkThread;
#[derive(Debug)]
pub(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/driver.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:7 | // ===== signal driver =====
cfg_signal_internal_and_unix! {
type SignalDriver = crate::runtime::signal::Driver;
pub(crate) type SignalHandle = Option<crate::runtime::signal::Handle>;
fn create_signal_driver(io_driver: IoDriver, io_handle: &crate::runtime::io::Handle) -> io::Result<(SignalDriver, SignalHa... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/driver.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:8 | fn create_process_driver(signal_driver: SignalDriver) -> ProcessDriver {
signal_driver
}
}
}
// ===== time driver =====
cfg_time! {
#[derive(Debug)]
pub(crate) enum TimeDriver {
Enabled {
driver: crate::runtime::time::Driver,
},
Disabled(IoStack),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/driver.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:9 | match self {
TimeDriver::Enabled { .. } => true,
TimeDriver::Disabled(inner) => inner.is_enabled(),
}
}
pub(crate) fn park(&mut self, handle: &Handle) {
match self {
TimeDriver::Enabled { driver, .. } => driver.park(handle),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6871084629ad95c37c7136d865890ab2e371ea12 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/driver.rs | 321 | 367 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:2 | pub(crate) start_paused: bool,
pub(crate) nevents: usize,
}
impl Driver {
pub(crate) fn new(cfg: Cfg) -> io::Result<(Self, Handle)> {
let (io_stack, io_handle, signal_handle) = create_io_stack(cfg.enable_io, cfg.nevents)?;
let clock = create_clock(cfg.enable_pause_time, cfg.start_paused);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 8832e936b1b86946ce802c5494bd8d575f8ba3a3 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/8832e936b1b86946ce802c5494bd8d575f8ba3a3/tokio/src/runtime/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:1 | //! Abstracts out the entire chain of runtime sub-drivers into common types.
// Eventually, this file will see significant refactoring / cleanup. For now, we
// don't need to worry much about dead code with certain feature permutations.
#![cfg_attr(not(feature = "full"), allow(dead_code))]
use crate::runtime::park::{... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:2 | impl Driver {
pub(crate) fn new(cfg: Cfg) -> io::Result<(Self, Handle)> {
let (io_stack, io_handle, signal_handle) = create_io_stack(cfg.enable_io, cfg.nevents)?;
let clock = create_clock(cfg.enable_pause_time, cfg.start_paused);
let (time_driver, time_handle) = create_time_driver(cfg.enab... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:3 | self.io.unpark();
}
cfg_io_driver! {
#[track_caller]
pub(crate) fn io(&self) -> &crate::runtime::io::Handle {
self.io
.as_ref()
.expect("A Tokio 1.x context was found, but IO is disabled. Call `enable_io` on the runtime builder to enable IO.")
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:4 | cfg_io_driver! {
pub(crate) type IoDriver = crate::runtime::io::Driver;
#[derive(Debug)]
pub(crate) enum IoStack {
Enabled(ProcessDriver),
Disabled(ParkThread),
}
#[derive(Debug)]
pub(crate) enum IoHandle {
Enabled(crate::runtime::io::Handle),
Disabled(UnparkThr... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:5 | }
}
pub(crate) fn park_timeout(&mut self, handle: &Handle, duration: Duration) {
match self {
IoStack::Enabled(v) => v.park_timeout(handle, duration),
IoStack::Disabled(v) => v.park_timeout(duration),
}
}
pub(crate) fn shutdown(&m... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/driver.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:6 | fn create_io_stack(_enabled: bool, _nevents: usize) -> io::Result<(IoStack, IoHandle, SignalHandle)> {
let park_thread = ParkThread::new();
let unpark_thread = park_thread.unpark();
Ok((IoStack(park_thread), unpark_thread, Default::default()))
}
impl IoStack {
pub(crate) fn park... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/driver.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:7 | fn create_signal_driver(io_driver: IoDriver, _io_handle: &crate::runtime::io::Handle) -> io::Result<(SignalDriver, SignalHandle)> {
Ok((io_driver, ()))
}
}
}
// ===== process driver =====
cfg_process_driver! {
type ProcessDriver = crate::runtime::process::Driver;
fn create_process_dri... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/driver.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:8 | fn create_clock(enable_pausing: bool, start_paused: bool) -> Clock {
crate::time::Clock::new(enable_pausing, start_paused)
}
fn create_time_driver(
enable: bool,
io_stack: IoStack,
clock: &Clock,
) -> (TimeDriver, TimeHandle) {
if enable {
let (driver, ha... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/driver.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:9 | }
}
cfg_not_time! {
type TimeDriver = IoStack;
pub(crate) type Clock = ();
pub(crate) type TimeHandle = ();
fn create_clock(_enable_pausing: bool, _start_paused: bool) -> Clock {
()
}
fn create_time_driver(
_enable: bool,
io_stack: IoStack,
_clock: &Clock,
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b | github | async-runtime | https://github.com/tokio-rs/tokio/blob/abf5d28f2ccaf55ea264f1bea7a1ac1bac6fe98b/tokio/src/runtime/driver.rs | 321 | 341 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:1 | //! Abstracts out the entire chain of runtime sub-drivers into common types.
// Eventually, this file will see significant refactoring / cleanup. For now, we
// don't need to worry much about dead code with certain feature permutations.
#![cfg_attr(not(feature = "full"), allow(dead_code))]
use crate::runtime::park::{... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 36039d0bb94d1accf8ae5569f6c50ca5a0c661ef | github | async-runtime | https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:2 | impl Driver {
pub(crate) fn new(cfg: Cfg) -> io::Result<(Self, Handle)> {
let (io_stack, io_handle, signal_handle) = create_io_stack(cfg.enable_io, cfg.nevents)?;
let clock = create_clock(cfg.enable_pause_time, cfg.start_paused);
let (time_driver, time_handle) =
create_time_dri... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 36039d0bb94d1accf8ae5569f6c50ca5a0c661ef | github | async-runtime | https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:3 | self.io.unpark();
}
cfg_io_driver! {
#[track_caller]
pub(crate) fn io(&self) -> &crate::runtime::io::Handle {
self.io
.as_ref()
.expect("A Tokio 1.x context was found, but IO is disabled. Call `enable_io` on the runtime builder to enable IO.")
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 36039d0bb94d1accf8ae5569f6c50ca5a0c661ef | github | async-runtime | https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:6 | #[derive(Debug)]
pub(crate) struct IoStack(ParkThread);
fn create_io_stack(_enabled: bool, _nevents: usize) -> io::Result<(IoStack, IoHandle, SignalHandle)> {
let park_thread = ParkThread::new();
let unpark_thread = park_thread.unpark();
Ok((IoStack(park_thread), unpark_thread, Default:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 36039d0bb94d1accf8ae5569f6c50ca5a0c661ef | github | async-runtime | https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/driver.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:7 | cfg_io_driver! {
type SignalDriver = IoDriver;
fn create_signal_driver(io_driver: IoDriver, _io_handle: &crate::runtime::io::Handle) -> io::Result<(SignalDriver, SignalHandle)> {
Ok((io_driver, ()))
}
}
}
// ===== process driver =====
cfg_process_driver! {
type ProcessDriv... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 36039d0bb94d1accf8ae5569f6c50ca5a0c661ef | github | async-runtime | https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/driver.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:8 | pub(crate) type Clock = crate::time::Clock;
pub(crate) type TimeHandle = Option<crate::runtime::time::Handle>;
fn create_clock(enable_pausing: bool, start_paused: bool) -> Clock {
crate::time::Clock::new(enable_pausing, start_paused)
}
fn create_time_driver(
enable: bool,
io_st... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 36039d0bb94d1accf8ae5569f6c50ca5a0c661ef | github | async-runtime | https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/driver.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:9 | TimeDriver::Disabled(v) => v.shutdown(handle),
}
}
}
}
cfg_not_time! {
type TimeDriver = IoStack;
pub(crate) type Clock = ();
pub(crate) type TimeHandle = ();
fn create_clock(_enable_pausing: bool, _start_paused: bool) -> Clock {
()
}
fn create_time_driver(
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 36039d0bb94d1accf8ae5569f6c50ca5a0c661ef | github | async-runtime | https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/driver.rs | 321 | 344 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:1 | //! Abstracts out the entire chain of runtime sub-drivers into common types.
// Eventually, this file will see significant refactoring / cleanup. For now, we
// don't need to worry much about dead code with certain feature permutations.
#![cfg_attr(not(feature = "full"), allow(dead_code))]
use crate::runtime::park::{... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 467adec4e16bdf1b5461e77d87d1d56b4a29f001 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/runtime/driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:2 | impl Driver {
pub(crate) fn new(cfg: Cfg) -> io::Result<(Self, Handle)> {
let (io_stack, io_handle, signal_handle) = create_io_stack(cfg.enable_io)?;
let clock = create_clock(cfg.enable_pause_time, cfg.start_paused);
let (time_driver, time_handle) =
create_time_driver(cfg.enabl... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 467adec4e16bdf1b5461e77d87d1d56b4a29f001 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/runtime/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:3 | self.io.unpark();
}
cfg_io_driver! {
#[track_caller]
pub(crate) fn io(&self) -> &crate::runtime::io::Handle {
self.io
.as_ref()
.expect("A Tokio 1.x context was found, but IO is disabled. Call `enable_io` on the runtime builder to enable IO.")
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 467adec4e16bdf1b5461e77d87d1d56b4a29f001 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/runtime/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:4 | // ===== io driver =====
cfg_io_driver! {
pub(crate) type IoDriver = crate::runtime::io::Driver;
#[derive(Debug)]
pub(crate) enum IoStack {
Enabled(ProcessDriver),
Disabled(ParkThread),
}
#[derive(Debug)]
pub(crate) enum IoHandle {
Enabled(crate::runtime::io::Handle),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 467adec4e16bdf1b5461e77d87d1d56b4a29f001 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/runtime/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:5 | IoStack::Enabled(v) => v.park(handle),
IoStack::Disabled(v) => v.park(),
}
}
pub(crate) fn park_timeout(&mut self, handle: &Handle, duration: Duration) {
match self {
IoStack::Enabled(v) => v.park_timeout(handle, duration),
IoStack... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 467adec4e16bdf1b5461e77d87d1d56b4a29f001 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/runtime/driver.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:6 | #[derive(Debug)]
pub(crate) struct IoStack(ParkThread);
fn create_io_stack(_enabled: bool) -> io::Result<(IoStack, IoHandle, SignalHandle)> {
let park_thread = ParkThread::new();
let unpark_thread = park_thread.unpark();
Ok((IoStack(park_thread), unpark_thread, Default::default()))
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 467adec4e16bdf1b5461e77d87d1d56b4a29f001 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/runtime/driver.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:7 | cfg_io_driver! {
type SignalDriver = IoDriver;
fn create_signal_driver(io_driver: IoDriver, _io_handle: &crate::runtime::io::Handle) -> io::Result<(SignalDriver, SignalHandle)> {
Ok((io_driver, ()))
}
}
}
// ===== process driver =====
cfg_process_driver! {
type ProcessDriv... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 467adec4e16bdf1b5461e77d87d1d56b4a29f001 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/runtime/driver.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:8 | pub(crate) type Clock = crate::time::Clock;
pub(crate) type TimeHandle = Option<crate::runtime::time::Handle>;
fn create_clock(enable_pausing: bool, start_paused: bool) -> Clock {
crate::time::Clock::new(enable_pausing, start_paused)
}
fn create_time_driver(
enable: bool,
io_st... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 467adec4e16bdf1b5461e77d87d1d56b4a29f001 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/runtime/driver.rs | 281 | 340 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:9 | }
}
}
}
cfg_not_time! {
type TimeDriver = IoStack;
pub(crate) type Clock = ();
pub(crate) type TimeHandle = ();
fn create_clock(_enable_pausing: bool, _start_paused: bool) -> Clock {
()
}
fn create_time_driver(
_enable: bool,
io_stack: IoStack,
_cl... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 467adec4e16bdf1b5461e77d87d1d56b4a29f001 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/467adec4e16bdf1b5461e77d87d1d56b4a29f001/tokio/src/runtime/driver.rs | 321 | 343 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:1 | //! Abstracts out the entire chain of runtime sub-drivers into common types.
// Eventually, this file will see significant refactoring / cleanup. For now, we
// don't need to worry much about dead code with certain feature permutations.
#![cfg_attr(not(feature = "full"), allow(dead_code))]
use crate::park::thread::{P... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 7483509746e1d82d7fc3642fd8431116c96aa387 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/7483509746e1d82d7fc3642fd8431116c96aa387/tokio/src/runtime/driver.rs | 1 | 60 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:3 | self.io.unpark();
}
cfg_io_driver! {
#[track_caller]
pub(crate) fn io(&self) -> &crate::runtime::io::Handle {
self.io
.as_ref()
.expect("A Tokio 1.x context was found, but IO is disabled. Call `enable_io` on the runtime builder to enable IO.")
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6c19748f901a1b8cd7fbf84650f1647342b5a66e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6c19748f901a1b8cd7fbf84650f1647342b5a66e/tokio/src/runtime/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:4 | pub(crate) enum IoStack {
Enabled(ProcessDriver),
Disabled(ParkThread),
}
#[derive(Debug)]
pub(crate) enum IoHandle {
Enabled(crate::runtime::io::Handle),
Disabled(UnparkThread),
}
fn create_io_stack(enabled: bool) -> io::Result<(IoStack, IoHandle, SignalHandle)> {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6c19748f901a1b8cd7fbf84650f1647342b5a66e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6c19748f901a1b8cd7fbf84650f1647342b5a66e/tokio/src/runtime/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:5 | match self {
IoStack::Enabled(v) => v.park_timeout(handle, duration),
IoStack::Disabled(v) => v.park_timeout(duration),
}
}
pub(crate) fn shutdown(&mut self, handle: &Handle) {
match self {
IoStack::Enabled(v) => v.shutdown(handle)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6c19748f901a1b8cd7fbf84650f1647342b5a66e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6c19748f901a1b8cd7fbf84650f1647342b5a66e/tokio/src/runtime/driver.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:6 | Ok((IoStack(park_thread), unpark_thread, Default::default()))
}
impl IoStack {
pub(crate) fn park(&mut self, _handle: &Handle) {
self.0.park();
}
pub(crate) fn park_timeout(&mut self, _handle: &Handle, duration: Duration) {
self.0.park_timeout(duration);
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6c19748f901a1b8cd7fbf84650f1647342b5a66e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6c19748f901a1b8cd7fbf84650f1647342b5a66e/tokio/src/runtime/driver.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:7 | }
}
// ===== process driver =====
cfg_process_driver! {
type ProcessDriver = crate::runtime::process::Driver;
fn create_process_driver(signal_driver: SignalDriver) -> ProcessDriver {
ProcessDriver::new(signal_driver)
}
}
cfg_not_process_driver! {
cfg_io_driver! {
type ProcessDriver =... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6c19748f901a1b8cd7fbf84650f1647342b5a66e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6c19748f901a1b8cd7fbf84650f1647342b5a66e/tokio/src/runtime/driver.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:8 | fn create_time_driver(
enable: bool,
io_stack: IoStack,
clock: Clock,
) -> (TimeDriver, TimeHandle) {
if enable {
let (driver, handle) = crate::runtime::time::Driver::new(io_stack, clock);
(TimeDriver::Enabled { driver }, Some(handle))
} else {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6c19748f901a1b8cd7fbf84650f1647342b5a66e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6c19748f901a1b8cd7fbf84650f1647342b5a66e/tokio/src/runtime/driver.rs | 281 | 337 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:9 | type TimeDriver = IoStack;
pub(crate) type Clock = ();
pub(crate) type TimeHandle = ();
fn create_clock(_enable_pausing: bool, _start_paused: bool) -> Clock {
()
}
fn create_time_driver(
_enable: bool,
io_stack: IoStack,
_clock: Clock,
) -> (TimeDriver, TimeHan... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 6c19748f901a1b8cd7fbf84650f1647342b5a66e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/6c19748f901a1b8cd7fbf84650f1647342b5a66e/tokio/src/runtime/driver.rs | 321 | 337 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:2 | impl Driver {
pub(crate) fn new(cfg: Cfg) -> io::Result<(Self, Handle)> {
let (io_stack, io_handle, signal_handle) = create_io_stack(cfg.enable_io)?;
let clock = create_clock(cfg.enable_pause_time, cfg.start_paused);
let (time_driver, time_handle) =
create_time_driver(cfg.enabl... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 32d68fe579f818d349103fa0e9fccf3d80a9f717 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/32d68fe579f818d349103fa0e9fccf3d80a9f717/tokio/src/runtime/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:3 | self.io.unpark();
}
cfg_io_driver! {
#[track_caller]
pub(crate) fn io(&self) -> &crate::runtime::io::Handle {
self.io
.as_ref()
.expect("A Tokio 1.x context was found, but IO is disabled. Call `enable_io` on the runtime builder to enable IO.")
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 32d68fe579f818d349103fa0e9fccf3d80a9f717 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/32d68fe579f818d349103fa0e9fccf3d80a9f717/tokio/src/runtime/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:4 | }
fn create_io_stack(enabled: bool) -> io::Result<(IoStack, IoHandle, SignalHandle)> {
#[cfg(loom)]
assert!(!enabled);
let ret = if enabled {
let (io_driver, io_handle) = crate::runtime::io::Driver::new()?;
let (signal_driver, signal_handle) = create_signal_driver(... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 32d68fe579f818d349103fa0e9fccf3d80a9f717 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/32d68fe579f818d349103fa0e9fccf3d80a9f717/tokio/src/runtime/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:5 | IoStack::Disabled(v) => v.shutdown(),
}
}
}
impl IoHandle {
pub(crate) fn unpark(&self) {
match self {
IoHandle::Enabled(handle) => handle.unpark(),
IoHandle::Disabled(handle) => handle.unpark(),
}
}
pub(crate)... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 32d68fe579f818d349103fa0e9fccf3d80a9f717 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/32d68fe579f818d349103fa0e9fccf3d80a9f717/tokio/src/runtime/driver.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:6 | self.0.park_timeout(duration);
}
pub(crate) fn shutdown(&mut self, _handle: &Handle) {
self.0.shutdown();
}
}
}
// ===== signal driver =====
cfg_signal_internal_and_unix! {
type SignalDriver = crate::runtime::signal::Driver;
pub(crate) type SignalHandle = Option<crate:... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 32d68fe579f818d349103fa0e9fccf3d80a9f717 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/32d68fe579f818d349103fa0e9fccf3d80a9f717/tokio/src/runtime/driver.rs | 201 | 260 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:7 | ProcessDriver::new(signal_driver)
}
}
cfg_not_process_driver! {
cfg_io_driver! {
type ProcessDriver = SignalDriver;
fn create_process_driver(signal_driver: SignalDriver) -> ProcessDriver {
signal_driver
}
}
}
// ===== time driver =====
cfg_time! {
#[derive(Debug)]... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 32d68fe579f818d349103fa0e9fccf3d80a9f717 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/32d68fe579f818d349103fa0e9fccf3d80a9f717/tokio/src/runtime/driver.rs | 241 | 300 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:8 | (TimeDriver::Enabled { driver }, Some(handle))
} else {
(TimeDriver::Disabled(io_stack), None)
}
}
impl TimeDriver {
pub(crate) fn park(&mut self, handle: &Handle) {
match self {
TimeDriver::Enabled { driver, .. } => driver.park(handle),
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 32d68fe579f818d349103fa0e9fccf3d80a9f717 | github | async-runtime | https://github.com/tokio-rs/tokio/blob/32d68fe579f818d349103fa0e9fccf3d80a9f717/tokio/src/runtime/driver.rs | 281 | 328 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:3 | self.io.unpark();
}
cfg_io_driver! {
#[track_caller]
pub(crate) fn io(&self) -> &crate::runtime::io::Handle {
self.io
.as_ref()
.expect("A Tokio 1.x context was found, but IO is disabled. Call `enable_io` on the runtime builder to enable IO.")
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | cb67f28fe3c99956959669277fde889bc2dc252e | github | async-runtime | https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:2 | impl Driver {
pub(crate) fn new(cfg: Cfg) -> io::Result<(Self, Handle)> {
let (io_stack, io_handle, signal_handle) = create_io_stack(cfg.enable_io)?;
let clock = create_clock(cfg.enable_pause_time, cfg.start_paused);
let (time_driver, time_handle) =
create_time_driver(cfg.enabl... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 58c457190b8a79b7ed8a76910e4d84d9d5de163d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/driver.rs | 41 | 100 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:3 | self.io.unpark();
}
cfg_io_driver! {
pub(crate) fn io(&self) -> &crate::runtime::io::Handle {
self.io
.as_ref()
.expect("A Tokio 1.x context was found, but I/O is disabled. Call `enable_io` on the runtime builder to enable I/O.")
}
}
cfg_time... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 58c457190b8a79b7ed8a76910e4d84d9d5de163d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/driver.rs | 81 | 140 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:4 | fn create_io_stack(enabled: bool) -> io::Result<(IoStack, IoHandle, SignalHandle)> {
#[cfg(loom)]
assert!(!enabled);
let ret = if enabled {
let (io_driver, io_handle) = crate::runtime::io::Driver::new()?;
let (signal_driver, signal_handle) = create_signal_driver(io_driv... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 58c457190b8a79b7ed8a76910e4d84d9d5de163d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/driver.rs | 121 | 180 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:5 | }
}
}
impl IoHandle {
pub(crate) fn unpark(&self) {
match self {
IoHandle::Enabled(handle) => handle.unpark(),
IoHandle::Disabled(handle) => handle.unpark(),
}
}
#[track_caller]
pub(crate) fn expect(self, msg: &'st... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 58c457190b8a79b7ed8a76910e4d84d9d5de163d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/driver.rs | 161 | 220 |
tokio-rs/tokio:tokio/src/runtime/driver.rs:6 | impl IoStack {
pub(crate) fn park(&mut self, _handle: &Handle) {
self.0.park();
}
pub(crate) fn park_timeout(&mut self, _handle: &Handle, duration: Duration) {
self.0.park_timeout(duration);
}
pub(crate) fn shutdown(&mut self, _handle: &Handle) {
... | rust | rust | rust-source | tokio-rs/tokio | tokio/src/runtime/driver.rs | MIT | 58c457190b8a79b7ed8a76910e4d84d9d5de163d | github | async-runtime | https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/driver.rs | 201 | 260 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.