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/io/mod.rs:5
self.tick = self.tick.wrapping_add(1); if self.tick == COMPACT_INTERVAL { self.resources.compact() } let events = &mut self.events; // Block waiting for an event to happen, peeling out how many events // happened. match self.poll.poll(events, max_wait) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
9af2f5ee5931a79684d4afd8897e54aafa39c156
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9af2f5ee5931a79684d4afd8897e54aafa39c156/tokio/src/runtime/io/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:6
} handle.metrics.incr_ready_count_by(ready_count); } fn dispatch(resources: &mut Slab<ScheduledIo>, tick: u8, token: mio::Token, ready: Ready) { let addr = slab::Address::from_usize(ADDRESS.unpack(token.0)); let io = match resources.get(addr) { Some(io) => io, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
9af2f5ee5931a79684d4afd8897e54aafa39c156
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9af2f5ee5931a79684d4afd8897e54aafa39c156/tokio/src/runtime/io/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:7
pub(crate) fn unpark(&self) { #[cfg(not(tokio_wasi))] self.waker.wake().expect("failed to wake I/O driver"); } /// Registers an I/O resource with the reactor for a given `mio::Ready` state. /// /// The registration token is returned. pub(super) fn add_source( &self, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
9af2f5ee5931a79684d4afd8897e54aafa39c156
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9af2f5ee5931a79684d4afd8897e54aafa39c156/tokio/src/runtime/io/mod.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:8
io.is_shutdown = true; true } fn allocate(&self) -> io::Result<(slab::Address, slab::Ref<ScheduledIo>)> { let io = self.io_dispatch.read().unwrap(); if io.is_shutdown { return Err(io::Error::new( io::ErrorKind::Other, crate::util::error::RUNTI...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
9af2f5ee5931a79684d4afd8897e54aafa39c156
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9af2f5ee5931a79684d4afd8897e54aafa39c156/tokio/src/runtime/io/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:9
match self { Direction::Read => Ready::READABLE | Ready::READ_CLOSED, Direction::Write => Ready::WRITABLE | Ready::WRITE_CLOSED, } } } // Signal handling cfg_signal_internal_and_unix! { impl Handle { pub(crate) fn register_signal_receiver(&self, receiver: &mut mio::net::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
9af2f5ee5931a79684d4afd8897e54aafa39c156
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9af2f5ee5931a79684d4afd8897e54aafa39c156/tokio/src/runtime/io/mod.rs
321
344
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:2
} /// A reference to an I/O driver. pub(crate) struct Handle { /// Registers I/O resources. registry: mio::Registry, /// Allocates `ScheduledIo` handles when creating new resources. io_dispatch: RwLock<IoDispatcher>, /// Used to wake up the reactor from a call to `turn`. /// Not supported on ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/io/mod.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:3
// TODO: Don't use a fake token. Instead, reserve a slot entry for the wakeup // token. const TOKEN_WAKEUP: mio::Token = mio::Token(1 << 31); const TOKEN_SIGNAL: mio::Token = mio::Token(1 + (1 << 31)); const ADDRESS: bit::Pack = bit::Pack::least_significant(24); // Packs the generation value in the `readiness` field....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/io/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:4
resources: slab, }; let handle = Handle { registry, io_dispatch: RwLock::new(IoDispatcher::new(allocator)), #[cfg(not(tokio_wasi))] waker, metrics: IoDriverMetrics::default(), }; Ok((driver, handle)) } pub(crate) fn p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/io/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:7
pub(crate) fn unpark(&self) { #[cfg(not(tokio_wasi))] self.waker.wake().expect("failed to wake I/O driver"); } /// Registers an I/O resource with the reactor for a given `mio::Ready` state. /// /// The registration token is returned. pub(super) fn add_source( &self, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/io/mod.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:8
io.is_shutdown = true; true } fn is_shutdown(&self) -> bool { return self.io_dispatch.read().unwrap().is_shutdown; } fn allocate(&self) -> io::Result<(slab::Address, slab::Ref<ScheduledIo>)> { let io = self.io_dispatch.read().unwrap(); if io.is_shutdown { re...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/io/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:9
} impl Direction { pub(super) fn mask(self) -> Ready { match self { Direction::Read => Ready::READABLE | Ready::READ_CLOSED, Direction::Write => Ready::WRITABLE | Ready::WRITE_CLOSED, } } } // Signal handling cfg_signal_internal_and_unix! { impl Handle { pub...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
36039d0bb94d1accf8ae5569f6c50ca5a0c661ef
github
async-runtime
https://github.com/tokio-rs/tokio/blob/36039d0bb94d1accf8ae5569f6c50ca5a0c661ef/tokio/src/runtime/io/mod.rs
321
348
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:3
// TODO: Don't use a fake token. Instead, reserve a slot entry for the wakeup // token. const TOKEN_WAKEUP: mio::Token = mio::Token(1 << 31); const TOKEN_SIGNAL: mio::Token = mio::Token(1 + (1 << 31)); const ADDRESS: bit::Pack = bit::Pack::least_significant(24); // Packs the generation value in the `readiness` field....
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
fc9518b62714daac9a38b46c698b94ac5d5b1ca2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/fc9518b62714daac9a38b46c698b94ac5d5b1ca2/tokio/src/runtime/io/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:4
resources: slab, }; let handle = Handle { registry, io_dispatch: RwLock::new(IoDispatcher::new(allocator)), #[cfg(not(tokio_wasi))] waker, metrics: IoDriverMetrics::default(), }; Ok((driver, handle)) } pub(crate) fn p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
32d68fe579f818d349103fa0e9fccf3d80a9f717
github
async-runtime
https://github.com/tokio-rs/tokio/blob/32d68fe579f818d349103fa0e9fccf3d80a9f717/tokio/src/runtime/io/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:5
self.tick = self.tick.wrapping_add(1); if self.tick == COMPACT_INTERVAL { self.resources.compact() } let mut events = &mut self.events; // Block waiting for an event to happen, peeling out how many events // happened. match self.poll.poll(&mut events, max_w...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
32d68fe579f818d349103fa0e9fccf3d80a9f717
github
async-runtime
https://github.com/tokio-rs/tokio/blob/32d68fe579f818d349103fa0e9fccf3d80a9f717/tokio/src/runtime/io/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:1
#![cfg_attr(not(all(feature = "rt", feature = "net")), allow(dead_code))] mod registration; pub(crate) use registration::Registration; mod scheduled_io; use scheduled_io::ScheduledIo; mod metrics; use crate::io::interest::Interest; use crate::io::ready::Ready; use crate::runtime::driver; use crate::util::slab::{sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/io/mod.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:2
poll: mio::Poll, } /// A reference to an I/O driver. #[derive(Clone)] pub(crate) struct Handle { pub(super) inner: Arc<Inner>, } #[derive(Debug)] pub(crate) struct ReadyEvent { tick: u8, pub(crate) ready: Ready, } struct IoDispatcher { allocator: slab::Allocator<ScheduledIo>, is_shutdown: bool, }...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/io/mod.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:3
enum Tick { Set(u8), Clear(u8), } // TODO: Don't use a fake token. Instead, reserve a slot entry for the wakeup // token. const TOKEN_WAKEUP: mio::Token = mio::Token(1 << 31); const TOKEN_SIGNAL: mio::Token = mio::Token(1 + (1 << 31)); const ADDRESS: bit::Pack = bit::Pack::least_significant(24); // Packs the...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/io/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:4
let driver = Driver { tick: 0, signal_ready: false, events: mio::Events::with_capacity(1024), poll, resources: slab, }; let handle = Handle { inner: Arc::new(Inner { registry, io_dispatch: RwLock::ne...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/io/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:5
io.shutdown(); }); } } fn turn(&mut self, handle: &Handle, max_wait: Option<Duration>) { // How often to call `compact()` on the resource slab const COMPACT_INTERVAL: u8 = 255; self.tick = self.tick.wrapping_add(1); if self.tick == COMPACT_INTERVAL { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/io/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:6
Self::dispatch( &mut self.resources, self.tick, token, Ready::from_mio(event), ); ready_count += 1; } } handle.inner.metrics.incr_ready_count_by(ready_count); } fn dispat...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/io/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:7
impl Handle { pub(crate) fn metrics(&self) -> &IoDriverMetrics { &self.inner.metrics } } } } impl Handle { /// Forces a reactor blocked in a call to `turn` to wakeup, or otherwise /// makes the next call to `turn` return immediately. /// /// This meth...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/io/mod.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:8
// ===== impl Inner ===== impl Inner { /// Registers an I/O resource with the reactor for a given `mio::Ready` state. /// /// The registration token is returned. pub(super) fn add_source( &self, source: &mut impl mio::event::Source, interest: Interest, ) -> io::Result<slab::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/io/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:9
true } fn is_shutdown(&self) -> bool { return self.io_dispatch.read().unwrap().is_shutdown; } fn allocate(&self) -> io::Result<(slab::Address, slab::Ref<ScheduledIo>)> { let io = self.io_dispatch.read().unwrap(); if io.is_shutdown { return Err(io::Error::new( ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/io/mod.rs
321
370
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:10
} impl Driver { pub(crate) fn consume_signal_ready(&mut self) -> bool { let ret = self.signal_ready; self.signal_ready = false; ret } } }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
cb67f28fe3c99956959669277fde889bc2dc252e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/cb67f28fe3c99956959669277fde889bc2dc252e/tokio/src/runtime/io/mod.rs
361
370
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:6
Self::dispatch( &mut self.resources, self.tick, token, Ready::from_mio(event), ); ready_count += 1; } } handle.inner.metrics.incr_ready_count_by(ready_count); } fn dispat...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
58c457190b8a79b7ed8a76910e4d84d9d5de163d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/io/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:7
cfg_rt! { impl Handle { /// Returns a handle to the current reactor. /// /// # Panics /// /// This function panics if there is no current reactor set and `rt` feature /// flag is not enabled. #[track_caller] pub(crate) fn current() -> Self { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
58c457190b8a79b7ed8a76910e4d84d9d5de163d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/io/mod.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:8
impl Handle { /// Forces a reactor blocked in a call to `turn` to wakeup, or otherwise /// makes the next call to `turn` return immediately. /// /// This method is intended to be used in situations where a notification /// needs to otherwise be sent to the main reactor. If the reactor is /// cur...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
58c457190b8a79b7ed8a76910e4d84d9d5de163d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/io/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:9
&self, source: &mut impl mio::event::Source, interest: Interest, ) -> io::Result<slab::Ref<ScheduledIo>> { let (address, shared) = self.allocate()?; let token = GENERATION.pack(shared.generation(), ADDRESS.pack(address.as_usize(), 0)); self.registry .register(so...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
58c457190b8a79b7ed8a76910e4d84d9d5de163d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/io/mod.rs
321
380
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:10
let io = self.io_dispatch.read().unwrap(); if io.is_shutdown { return Err(io::Error::new( io::ErrorKind::Other, "failed to find event loop", )); } io.allocator.allocate().ok_or_else(|| { io::Error::new( io::Error...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
58c457190b8a79b7ed8a76910e4d84d9d5de163d
github
async-runtime
https://github.com/tokio-rs/tokio/blob/58c457190b8a79b7ed8a76910e4d84d9d5de163d/tokio/src/runtime/io/mod.rs
361
402
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:1
#![cfg_attr(not(all(feature = "rt", feature = "net")), allow(dead_code))] mod registration; pub(crate) use registration::Registration; mod scheduled_io; use scheduled_io::ScheduledIo; mod metrics; use crate::io::interest::Interest; use crate::io::ready::Ready; use crate::util::slab::{self, Slab}; use crate::{loom::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
ec66a92b016914f2ead483bada32ffe696a2fd3a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ec66a92b016914f2ead483bada32ffe696a2fd3a/tokio/src/runtime/io/mod.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:2
/// State shared between the reactor and the handles. inner: Arc<Inner>, } /// A reference to an I/O driver. #[derive(Clone)] pub(crate) struct Handle { pub(super) inner: Arc<Inner>, } #[derive(Debug)] pub(crate) struct ReadyEvent { tick: u8, pub(crate) ready: Ready, } struct IoDispatcher { alloc...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
ec66a92b016914f2ead483bada32ffe696a2fd3a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ec66a92b016914f2ead483bada32ffe696a2fd3a/tokio/src/runtime/io/mod.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:3
Write, } enum Tick { Set(u8), Clear(u8), } // TODO: Don't use a fake token. Instead, reserve a slot entry for the wakeup // token. const TOKEN_WAKEUP: mio::Token = mio::Token(1 << 31); const TOKEN_SIGNAL: mio::Token = mio::Token(1 + (1 << 31)); const ADDRESS: bit::Pack = bit::Pack::least_significant(24); //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
ec66a92b016914f2ead483bada32ffe696a2fd3a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ec66a92b016914f2ead483bada32ffe696a2fd3a/tokio/src/runtime/io/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:4
let slab = Slab::new(); let allocator = slab.allocator(); Ok(Driver { tick: 0, signal_ready: false, events: mio::Events::with_capacity(1024), poll, resources: slab, inner: Arc::new(Inner { registry, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
ec66a92b016914f2ead483bada32ffe696a2fd3a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ec66a92b016914f2ead483bada32ffe696a2fd3a/tokio/src/runtime/io/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:5
if self.inner.shutdown() { self.resources.for_each(|io| { // If a task is waiting on the I/O resource, notify it. The task // will then attempt to use the I/O resource and fail due to the // driver being shutdown. And shutdown will clear all wakers. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
ec66a92b016914f2ead483bada32ffe696a2fd3a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ec66a92b016914f2ead483bada32ffe696a2fd3a/tokio/src/runtime/io/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:6
if token == TOKEN_WAKEUP { // Nothing to do, the event is used to unblock the I/O driver } else if token == TOKEN_SIGNAL { self.signal_ready = true; } else { Self::dispatch( &mut self.resources, self.tick, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
ec66a92b016914f2ead483bada32ffe696a2fd3a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ec66a92b016914f2ead483bada32ffe696a2fd3a/tokio/src/runtime/io/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:7
} } // ===== impl Handle ===== cfg_rt! { impl Handle { /// Returns a handle to the current reactor. /// /// # Panics /// /// This function panics if there is no current reactor set and `rt` feature /// flag is not enabled. #[track_caller] pub(crate) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
ec66a92b016914f2ead483bada32ffe696a2fd3a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ec66a92b016914f2ead483bada32ffe696a2fd3a/tokio/src/runtime/io/mod.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:8
} } } } impl Handle { /// Forces a reactor blocked in a call to `turn` to wakeup, or otherwise /// makes the next call to `turn` return immediately. /// /// This method is intended to be used in situations where a notification /// needs to otherwise be sent to the main reactor. If the r...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
ec66a92b016914f2ead483bada32ffe696a2fd3a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ec66a92b016914f2ead483bada32ffe696a2fd3a/tokio/src/runtime/io/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:9
impl Inner { /// Registers an I/O resource with the reactor for a given `mio::Ready` state. /// /// The registration token is returned. pub(super) fn add_source( &self, source: &mut impl mio::event::Source, interest: Interest, ) -> io::Result<slab::Ref<ScheduledIo>> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
ec66a92b016914f2ead483bada32ffe696a2fd3a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ec66a92b016914f2ead483bada32ffe696a2fd3a/tokio/src/runtime/io/mod.rs
321
380
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:10
fn is_shutdown(&self) -> bool { return self.io_dispatch.read().unwrap().is_shutdown; } fn allocate(&self) -> io::Result<(slab::Address, slab::Ref<ScheduledIo>)> { let io = self.io_dispatch.read().unwrap(); if io.is_shutdown { return Err(io::Error::new( io::Er...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
ec66a92b016914f2ead483bada32ffe696a2fd3a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ec66a92b016914f2ead483bada32ffe696a2fd3a/tokio/src/runtime/io/mod.rs
361
405
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:1
#![cfg_attr(not(feature = "rt"), allow(dead_code))] mod registration; pub(crate) use registration::Registration; mod scheduled_io; use scheduled_io::ScheduledIo; mod metrics; use crate::io::interest::Interest; use crate::io::ready::Ready; use crate::util::slab::{self, Slab}; use crate::{loom::sync::RwLock, util::bi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
992a16812258bae5192a997484ada046a88a6425
github
async-runtime
https://github.com/tokio-rs/tokio/blob/992a16812258bae5192a997484ada046a88a6425/tokio/src/runtime/io/mod.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:2
} /// A reference to an I/O driver. #[derive(Clone)] pub(crate) struct Handle { pub(super) inner: Arc<Inner>, } #[derive(Debug)] pub(crate) struct ReadyEvent { tick: u8, pub(crate) ready: Ready, } struct IoDispatcher { allocator: slab::Allocator<ScheduledIo>, is_shutdown: bool, } pub(super) stru...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
992a16812258bae5192a997484ada046a88a6425
github
async-runtime
https://github.com/tokio-rs/tokio/blob/992a16812258bae5192a997484ada046a88a6425/tokio/src/runtime/io/mod.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:3
enum Tick { Set(u8), Clear(u8), } // TODO: Don't use a fake token. Instead, reserve a slot entry for the wakeup // token. const TOKEN_WAKEUP: mio::Token = mio::Token(1 << 31); const ADDRESS: bit::Pack = bit::Pack::least_significant(24); // Packs the generation value in the `readiness` field. // // The genera...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
992a16812258bae5192a997484ada046a88a6425
github
async-runtime
https://github.com/tokio-rs/tokio/blob/992a16812258bae5192a997484ada046a88a6425/tokio/src/runtime/io/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:4
tick: 0, events: mio::Events::with_capacity(1024), poll, resources: slab, inner: Arc::new(Inner { registry, io_dispatch: RwLock::new(IoDispatcher::new(allocator)), #[cfg(not(tokio_wasi))] waker, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
992a16812258bae5192a997484ada046a88a6425
github
async-runtime
https://github.com/tokio-rs/tokio/blob/992a16812258bae5192a997484ada046a88a6425/tokio/src/runtime/io/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:5
io.shutdown(); }); } } fn turn(&mut self, max_wait: Option<Duration>) { // How often to call `compact()` on the resource slab const COMPACT_INTERVAL: u8 = 255; self.tick = self.tick.wrapping_add(1); if self.tick == COMPACT_INTERVAL { self.resour...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
992a16812258bae5192a997484ada046a88a6425
github
async-runtime
https://github.com/tokio-rs/tokio/blob/992a16812258bae5192a997484ada046a88a6425/tokio/src/runtime/io/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:6
Ready::from_mio(event), ); ready_count += 1; } } self.inner.metrics.incr_ready_count_by(ready_count); } fn dispatch(resources: &mut Slab<ScheduledIo>, tick: u8, token: mio::Token, ready: Ready) { let addr = slab::Address::from_usize(ADDRESS.u...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
992a16812258bae5192a997484ada046a88a6425
github
async-runtime
https://github.com/tokio-rs/tokio/blob/992a16812258bae5192a997484ada046a88a6425/tokio/src/runtime/io/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:7
/// # Panics /// /// This function panics if there is no current reactor set and `rt` feature /// flag is not enabled. #[track_caller] pub(crate) fn current() -> Self { crate::runtime::context::io_handle().expect("A Tokio 1.x context was found, but IO is disabled. Cal...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
992a16812258bae5192a997484ada046a88a6425
github
async-runtime
https://github.com/tokio-rs/tokio/blob/992a16812258bae5192a997484ada046a88a6425/tokio/src/runtime/io/mod.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:8
/// This method is intended to be used in situations where a notification /// needs to otherwise be sent to the main reactor. If the reactor is /// currently blocked inside of `turn` then it will wake up and soon return /// after this method has been called. If the reactor is not currently /// blocked i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
992a16812258bae5192a997484ada046a88a6425
github
async-runtime
https://github.com/tokio-rs/tokio/blob/992a16812258bae5192a997484ada046a88a6425/tokio/src/runtime/io/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:9
let (address, shared) = self.allocate()?; let token = GENERATION.pack(shared.generation(), ADDRESS.pack(address.as_usize(), 0)); self.registry .register(source, mio::Token(token), interest.to_mio())?; self.metrics.incr_fd_count(); Ok(shared) } /// Deregisters an ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
992a16812258bae5192a997484ada046a88a6425
github
async-runtime
https://github.com/tokio-rs/tokio/blob/992a16812258bae5192a997484ada046a88a6425/tokio/src/runtime/io/mod.rs
321
380
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:10
"failed to find event loop", )); } io.allocator.allocate().ok_or_else(|| { io::Error::new( io::ErrorKind::Other, "reactor at max registered I/O resources", ) }) } } impl Direction { pub(super) fn mask(self) -> Ready { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
992a16812258bae5192a997484ada046a88a6425
github
async-runtime
https://github.com/tokio-rs/tokio/blob/992a16812258bae5192a997484ada046a88a6425/tokio/src/runtime/io/mod.rs
361
380
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:1
#![cfg_attr(not(feature = "rt"), allow(dead_code))] mod registration; pub(crate) use registration::Registration; mod scheduled_io; use scheduled_io::ScheduledIo; mod metrics; use crate::io::interest::Interest; use crate::io::ready::Ready; use crate::util::slab::{self, Slab}; use crate::{loom::sync::RwLock, util::bi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/runtime/io/mod.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:3
enum Tick { Set(u8), Clear(u8), } // TODO: Don't use a fake token. Instead, reserve a slot entry for the wakeup // token. const TOKEN_WAKEUP: mio::Token = mio::Token(1 << 31); const ADDRESS: bit::Pack = bit::Pack::least_significant(24); // Packs the generation value in the `readiness` field. // // The genera...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/runtime/io/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:4
tick: 0, events: Some(mio::Events::with_capacity(1024)), poll, resources: slab, inner: Arc::new(Inner { registry, io_dispatch: RwLock::new(IoDispatcher::new(allocator)), #[cfg(not(tokio_wasi))] waker, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/runtime/io/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:5
io.shutdown(); }); } } fn turn(&mut self, max_wait: Option<Duration>) { // How often to call `compact()` on the resource slab const COMPACT_INTERVAL: u8 = 255; self.tick = self.tick.wrapping_add(1); if self.tick == COMPACT_INTERVAL { self.resour...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/runtime/io/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:6
self.inner.metrics.incr_ready_count_by(ready_count); self.events = Some(events); } fn dispatch(&mut self, token: mio::Token, ready: Ready) { let addr = slab::Address::from_usize(ADDRESS.unpack(token.0)); let resources = &mut self.resources; let io = match resources.get(addr) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/runtime/io/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:7
/// /// This function panics if there is no current reactor set and `rt` feature /// flag is not enabled. #[track_caller] pub(crate) fn current() -> Self { crate::runtime::context::io_handle().expect("A Tokio 1.x context was found, but IO is disabled. Call `enable_io` on the ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/runtime/io/mod.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:8
/// needs to otherwise be sent to the main reactor. If the reactor is /// currently blocked inside of `turn` then it will wake up and soon return /// after this method has been called. If the reactor is not currently /// blocked in `turn`, then the next call to `turn` will not block and /// return immed...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/runtime/io/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:9
let token = GENERATION.pack(shared.generation(), ADDRESS.pack(address.as_usize(), 0)); self.registry .register(source, mio::Token(token), interest.to_mio())?; self.metrics.incr_fd_count(); Ok(shared) } /// Deregisters an I/O resource from the reactor. pub(super) fn de...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/runtime/io/mod.rs
321
379
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:10
)); } io.allocator.allocate().ok_or_else(|| { io::Error::new( io::ErrorKind::Other, "reactor at max registered I/O resources", ) }) } } impl Direction { pub(super) fn mask(self) -> Ready { match self { Direction...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
0b92f80a6506c6a89eb998e5f61a33415353bba1
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0b92f80a6506c6a89eb998e5f61a33415353bba1/tokio/src/runtime/io/mod.rs
361
379
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:4
tick: 0, events: Some(mio::Events::with_capacity(1024)), poll, resources: slab, inner: Arc::new(Inner { registry, io_dispatch: RwLock::new(IoDispatcher::new(allocator)), #[cfg(not(tokio_wasi))] waker, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
98e642d23477d1af8d7a62d41d9907e567241a71
github
async-runtime
https://github.com/tokio-rs/tokio/blob/98e642d23477d1af8d7a62d41d9907e567241a71/tokio/src/runtime/io/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:5
if self.inner.shutdown() { self.resources.for_each(|io| { // If a task is waiting on the I/O resource, notify it. The task // will then attempt to use the I/O resource and fail due to the // driver being shutdown. And shutdown will clear all wakers. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
98e642d23477d1af8d7a62d41d9907e567241a71
github
async-runtime
https://github.com/tokio-rs/tokio/blob/98e642d23477d1af8d7a62d41d9907e567241a71/tokio/src/runtime/io/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:6
if token != TOKEN_WAKEUP { self.dispatch(token, Ready::from_mio(event)); ready_count += 1; } } self.inner.metrics.incr_ready_count_by(ready_count); self.events = Some(events); } fn dispatch(&mut self, token: mio::Token, ready: Ready) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
98e642d23477d1af8d7a62d41d9907e567241a71
github
async-runtime
https://github.com/tokio-rs/tokio/blob/98e642d23477d1af8d7a62d41d9907e567241a71/tokio/src/runtime/io/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:10
let io = self.io_dispatch.read().unwrap(); if io.is_shutdown { return Err(io::Error::new( io::ErrorKind::Other, "failed to find event loop", )); } io.allocator.allocate().ok_or_else(|| { io::Error::new( io::Error...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
98e642d23477d1af8d7a62d41d9907e567241a71
github
async-runtime
https://github.com/tokio-rs/tokio/blob/98e642d23477d1af8d7a62d41d9907e567241a71/tokio/src/runtime/io/mod.rs
361
384
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:6
if token != TOKEN_WAKEUP { self.dispatch(token, Ready::from_mio(event)); ready_count += 1; } } self.inner.metrics.incr_ready_count_by(ready_count); self.events = Some(events); } fn dispatch(&mut self, token: mio::Token, ready: Ready) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
b891714bdb3ff8a52c356bbaa0cddd9206f42cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b891714bdb3ff8a52c356bbaa0cddd9206f42cfd/tokio/src/runtime/io/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:7
write!(f, "Driver") } } // ===== impl Handle ===== cfg_rt! { impl Handle { /// Returns a handle to the current reactor. /// /// # Panics /// /// This function panics if there is no current reactor set and `rt` feature /// flag is not enabled. #[track_cal...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
b891714bdb3ff8a52c356bbaa0cddd9206f42cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b891714bdb3ff8a52c356bbaa0cddd9206f42cfd/tokio/src/runtime/io/mod.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:8
&self.inner.metrics } } } } impl Handle { /// Forces a reactor blocked in a call to `turn` to wakeup, or otherwise /// makes the next call to `turn` return immediately. /// /// This method is intended to be used in situations where a notification /// needs to otherwise be se...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
b891714bdb3ff8a52c356bbaa0cddd9206f42cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b891714bdb3ff8a52c356bbaa0cddd9206f42cfd/tokio/src/runtime/io/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:9
impl Inner { /// Registers an I/O resource with the reactor for a given `mio::Ready` state. /// /// The registration token is returned. pub(super) fn add_source( &self, source: &mut impl mio::event::Source, interest: Interest, ) -> io::Result<slab::Ref<ScheduledIo>> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
b891714bdb3ff8a52c356bbaa0cddd9206f42cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b891714bdb3ff8a52c356bbaa0cddd9206f42cfd/tokio/src/runtime/io/mod.rs
321
380
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:10
fn is_shutdown(&self) -> bool { return self.io_dispatch.read().unwrap().is_shutdown; } fn allocate(&self) -> io::Result<(slab::Address, slab::Ref<ScheduledIo>)> { let io = self.io_dispatch.read().unwrap(); if io.is_shutdown { return Err(io::Error::new( io::Er...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
b891714bdb3ff8a52c356bbaa0cddd9206f42cfd
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b891714bdb3ff8a52c356bbaa0cddd9206f42cfd/tokio/src/runtime/io/mod.rs
361
390
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:4
tick: 0, events: Some(mio::Events::with_capacity(1024)), poll, resources: slab, inner: Arc::new(Inner { registry, io_dispatch: RwLock::new(IoDispatcher::new(allocator)), #[cfg(not(tokio_wasi))] waker, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/io/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:5
self.turn(Some(duration)); } pub(crate) fn shutdown(&mut self) { if self.inner.shutdown() { self.resources.for_each(|io| { // If a task is waiting on the I/O resource, notify it. The task // will then attempt to use the I/O resource and fail due to the ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/io/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:6
let mut ready_count = 0; for event in events.iter() { let token = event.token(); if token != TOKEN_WAKEUP { self.dispatch(token, Ready::from_mio(event)); ready_count += 1; } } self.inner.metrics.incr_ready_count_by(ready_count...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/io/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:7
} impl fmt::Debug for Driver { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "Driver") } } // ===== impl Handle ===== cfg_rt! { impl Handle { /// Returns a handle to the current reactor. /// /// # Panics /// /// This function panics i...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/io/mod.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:8
cfg_net! { cfg_metrics! { impl Handle { pub(crate) fn metrics(&self) -> &IoDriverMetrics { &self.inner.metrics } } } } impl Handle { /// Forces a reactor blocked in a call to `turn` to wakeup, or otherwise /// makes the next call to `turn` return ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/io/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:9
} } // ===== impl Inner ===== impl Inner { /// Registers an I/O resource with the reactor for a given `mio::Ready` state. /// /// The registration token is returned. pub(super) fn add_source( &self, source: &mut impl mio::event::Source, interest: Interest, ) -> io::Result<s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/io/mod.rs
321
380
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:10
} io.is_shutdown = true; true } fn is_shutdown(&self) -> bool { return self.io_dispatch.read().unwrap().is_shutdown; } fn allocate(&self) -> io::Result<(slab::Address, slab::Ref<ScheduledIo>)> { let io = self.io_dispatch.read().unwrap(); if io.is_shutdown { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
99aa8d12b7ad2ef011a7a9f652f7455b3f175821
github
async-runtime
https://github.com/tokio-rs/tokio/blob/99aa8d12b7ad2ef011a7a9f652f7455b3f175821/tokio/src/runtime/io/mod.rs
361
394
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:1
#![cfg_attr(not(feature = "net"), allow(dead_code))] use crate::io::interest::Interest; use crate::runtime::io::{Direction, Handle, ReadyEvent, ScheduledIo}; use crate::runtime::scheduler; use mio::event::Source; use std::io; use std::sync::Arc; use std::task::{ready, Context, Poll}; cfg_io_driver! { /// Associa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/registration.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:2
/// /// [`new_with_interest_and_handle`]: method@Self::new_with_interest_and_handle /// [`poll_read_ready`]: method@Self::poll_read_ready` /// [`poll_write_ready`]: method@Self::poll_write_ready` #[derive(Debug)] pub(crate) struct Registration { /// Handle to the associated runtime. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/registration.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:3
} /// Deregisters the I/O resource from the reactor it is associated with. /// /// This function must be called before the I/O resource associated with the /// registration is dropped. /// /// Note that deregistering does not guarantee that the I/O resource can be /// registered with a diff...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/registration.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:4
#[cfg(not(all(target_os = "wasi", target_env = "p1")))] pub(crate) fn poll_read_io<R>( &self, cx: &mut Context<'_>, f: impl FnMut() -> io::Result<R>, ) -> Poll<io::Result<R>> { self.poll_io(cx, Direction::Read, f) } // Uses the poll path, requiring the caller to ensure m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/registration.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:5
fn poll_io<R>( &self, cx: &mut Context<'_>, direction: Direction, mut f: impl FnMut() -> io::Result<R>, ) -> Poll<io::Result<R>> { loop { let ev = ready!(self.poll_ready(cx, direction))?; match f() { Ok(ret) => { re...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/registration.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:6
} } pub(crate) async fn readiness(&self, interest: Interest) -> io::Result<ReadyEvent> { let ev = self.shared.readiness(interest).await; if ev.is_shutdown { return Err(gone()); } Ok(ev) } pub(crate) async fn async_io<R>( &self, interest: In...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/registration.rs
201
259
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:7
impl Drop for Registration { fn drop(&mut self) { // It is possible for a cycle to be created between wakers stored in // `ScheduledIo` instances and `Arc<driver::Inner>`. To break this // cycle, wakers are cleared. This is an imperfect solution as it is // possible to store a `Regis...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/registration.rs
241
259
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:4
#[cfg(not(all(target_os = "wasi", target_env = "p1")))] pub(crate) fn poll_read_io<R>( &self, cx: &mut Context<'_>, f: impl FnMut() -> io::Result<R>, ) -> Poll<io::Result<R>> { self.poll_io(cx, Direction::Read, f) } // Uses the poll path, requiring the caller to ensure m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
43134f1e5784993eb4fb3863933d74ac9e28f598
github
async-runtime
https://github.com/tokio-rs/tokio/blob/43134f1e5784993eb4fb3863933d74ac9e28f598/tokio/src/runtime/io/registration.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:3
} /// Deregisters the I/O resource from the reactor it is associated with. /// /// This function must be called before the I/O resource associated with the /// registration is dropped. /// /// Note that deregistering does not guarantee that the I/O resource can be /// registered with a diff...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
605ef578df04f12a951060dc3b2fb930f6f379fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/605ef578df04f12a951060dc3b2fb930f6f379fe/tokio/src/runtime/io/registration.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:4
#[cfg(not(target_os = "wasi"))] pub(crate) fn poll_read_io<R>( &self, cx: &mut Context<'_>, f: impl FnMut() -> io::Result<R>, ) -> Poll<io::Result<R>> { self.poll_io(cx, Direction::Read, f) } // Uses the poll path, requiring the caller to ensure mutual exclusion for ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
605ef578df04f12a951060dc3b2fb930f6f379fe
github
async-runtime
https://github.com/tokio-rs/tokio/blob/605ef578df04f12a951060dc3b2fb930f6f379fe/tokio/src/runtime/io/registration.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:4
#[cfg(not(target_os = "wasi"))] pub(crate) fn poll_read_io<R>( &self, cx: &mut Context<'_>, f: impl FnMut() -> io::Result<R>, ) -> Poll<io::Result<R>> { self.poll_io(cx, Direction::Read, f) } // Uses the poll path, requiring the caller to ensure mutual exclusion for ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
12b2567b959ec754e6f58fb76b88a1a38f805771
github
async-runtime
https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/src/runtime/io/registration.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:6
} } pub(crate) async fn readiness(&self, interest: Interest) -> io::Result<ReadyEvent> { let ev = self.shared.readiness(interest).await; if ev.is_shutdown { return Err(gone()); } Ok(ev) } pub(crate) async fn async_io<R>( &self, interest: In...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
12b2567b959ec754e6f58fb76b88a1a38f805771
github
async-runtime
https://github.com/tokio-rs/tokio/blob/12b2567b959ec754e6f58fb76b88a1a38f805771/tokio/src/runtime/io/registration.rs
201
259
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:6
} } pub(crate) async fn readiness(&self, interest: Interest) -> io::Result<ReadyEvent> { let ev = self.shared.readiness(interest).await; if ev.is_shutdown { return Err(gone()); } Ok(ev) } pub(crate) async fn async_io<R>( &self, interest: In...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
11f66f43a09169b893212b854c6c49985ff2224f
github
async-runtime
https://github.com/tokio-rs/tokio/blob/11f66f43a09169b893212b854c6c49985ff2224f/tokio/src/runtime/io/registration.rs
201
259
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:1
#![cfg_attr(not(feature = "net"), allow(dead_code))] use crate::io::interest::Interest; use crate::runtime::io::{Direction, Handle, ReadyEvent, ScheduledIo}; use crate::runtime::scheduler; use crate::util::slab; use mio::event::Source; use std::io; use std::task::{Context, Poll}; cfg_io_driver! { /// Associates ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
ab7313ff6b9107c8b9c6a068c620ac56935b80e7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab7313ff6b9107c8b9c6a068c620ac56935b80e7/tokio/src/runtime/io/registration.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:2
/// /// [`new_with_interest_and_handle`]: method@Self::new_with_interest_and_handle /// [`poll_read_ready`]: method@Self::poll_read_ready` /// [`poll_write_ready`]: method@Self::poll_write_ready` #[derive(Debug)] pub(crate) struct Registration { /// Handle to the associated runtime. ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
ab7313ff6b9107c8b9c6a068c620ac56935b80e7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab7313ff6b9107c8b9c6a068c620ac56935b80e7/tokio/src/runtime/io/registration.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:3
/// Deregisters the I/O resource from the reactor it is associated with. /// /// This function must be called before the I/O resource associated with the /// registration is dropped. /// /// Note that deregistering does not guarantee that the I/O resource can be /// registered with a different r...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
ab7313ff6b9107c8b9c6a068c620ac56935b80e7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab7313ff6b9107c8b9c6a068c620ac56935b80e7/tokio/src/runtime/io/registration.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:4
&self, cx: &mut Context<'_>, f: impl FnMut() -> io::Result<R>, ) -> Poll<io::Result<R>> { self.poll_io(cx, Direction::Read, f) } // Uses the poll path, requiring the caller to ensure mutual exclusion for // correctness. Only the last task to call this function is notified. p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
ab7313ff6b9107c8b9c6a068c620ac56935b80e7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab7313ff6b9107c8b9c6a068c620ac56935b80e7/tokio/src/runtime/io/registration.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:5
cx: &mut Context<'_>, direction: Direction, mut f: impl FnMut() -> io::Result<R>, ) -> Poll<io::Result<R>> { loop { let ev = ready!(self.poll_ready(cx, direction))?; match f() { Ok(ret) => { return Poll::Ready(Ok(ret)); ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
ab7313ff6b9107c8b9c6a068c620ac56935b80e7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab7313ff6b9107c8b9c6a068c620ac56935b80e7/tokio/src/runtime/io/registration.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:6
fn handle(&self) -> &Handle { self.handle.driver().io() } } impl Drop for Registration { fn drop(&mut self) { // It is possible for a cycle to be created between wakers stored in // `ScheduledIo` instances and `Arc<driver::Inner>`. To break this // cycle, wakers are cleared. Thi...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
ab7313ff6b9107c8b9c6a068c620ac56935b80e7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab7313ff6b9107c8b9c6a068c620ac56935b80e7/tokio/src/runtime/io/registration.rs
201
256
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:7
let coop = crate::future::poll_fn(crate::runtime::coop::poll_proceed).await; match f() { Err(ref e) if e.kind() == io::ErrorKind::WouldBlock => { self.clear_readiness(event); } x => { coop.made_p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
ab7313ff6b9107c8b9c6a068c620ac56935b80e7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ab7313ff6b9107c8b9c6a068c620ac56935b80e7/tokio/src/runtime/io/registration.rs
241
256
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:1
#![cfg_attr(not(feature = "net"), allow(dead_code))] use crate::io::interest::Interest; use crate::runtime::io::{Direction, Handle, ReadyEvent, ScheduledIo}; use crate::runtime::scheduler; use mio::event::Source; use std::io; use std::sync::Arc; use std::task::{Context, Poll}; cfg_io_driver! { /// Associates an ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/io/registration.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:6
} } pub(crate) async fn readiness(&self, interest: Interest) -> io::Result<ReadyEvent> { let ev = self.shared.readiness(interest).await; if ev.is_shutdown { return Err(gone()); } Ok(ev) } pub(crate) async fn async_io<R>( &self, interest: In...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/io/registration.rs
201
254
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:7
// possible to store a `Registration` in a waker. In this case, the // cycle would remain. // // See tokio-rs/tokio#3481 for more details. self.shared.clear_wakers(); } } fn gone() -> io::Error { io::Error::new( io::ErrorKind::Other, crate::util::error::RUNTIME_S...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/io/registration.rs
241
254
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:3
} /// Deregisters the I/O resource from the reactor it is associated with. /// /// This function must be called before the I/O resource associated with the /// registration is dropped. /// /// Note that deregistering does not guarantee that the I/O resource can be /// registered with a diff...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
b573adc733dc4cbff7b125738e2708e2518cca16
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b573adc733dc4cbff7b125738e2708e2518cca16/tokio/src/runtime/io/registration.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:4
#[cfg(not(tokio_wasi))] pub(crate) fn poll_read_io<R>( &self, cx: &mut Context<'_>, f: impl FnMut() -> io::Result<R>, ) -> Poll<io::Result<R>> { self.poll_io(cx, Direction::Read, f) } // Uses the poll path, requiring the caller to ensure mutual exclusion for // corre...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
b573adc733dc4cbff7b125738e2708e2518cca16
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b573adc733dc4cbff7b125738e2708e2518cca16/tokio/src/runtime/io/registration.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/registration.rs:4
&self, cx: &mut Context<'_>, f: impl FnMut() -> io::Result<R>, ) -> Poll<io::Result<R>> { self.poll_io(cx, Direction::Read, f) } // Uses the poll path, requiring the caller to ensure mutual exclusion for // correctness. Only the last task to call this function is notified. p...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/registration.rs
MIT
ce23db6bc7c6a2853377db629ca8b761a45e0476
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce23db6bc7c6a2853377db629ca8b761a45e0476/tokio/src/runtime/io/registration.rs
121
180