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/driver.rs:2
registrations: RegistrationSet, /// State that should be synchronized synced: Mutex<registration_set::Synced>, /// Used to wake up the reactor from a call to `turn`. /// Not supported on Wasi due to lack of threading support. #[cfg(not(target_os = "wasi"))] waker: mio::Waker, pub(crate) m...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
6871084629ad95c37c7136d865890ab2e371ea12
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/io/driver.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:3
Clear(u8), } const TOKEN_WAKEUP: mio::Token = mio::Token(0); const TOKEN_SIGNAL: mio::Token = mio::Token(1); fn _assert_kinds() { fn _assert<T: Send + Sync>() {} _assert::<Handle>(); } // ===== impl Driver ===== impl Driver { /// Creates a new event loop, returning any error that happened during the ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
6871084629ad95c37c7136d865890ab2e371ea12
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/io/driver.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:4
Ok((driver, handle)) } pub(crate) fn park(&mut self, rt_handle: &driver::Handle) { let handle = rt_handle.io(); self.turn(handle, None); } pub(crate) fn park_timeout(&mut self, rt_handle: &driver::Handle, duration: Duration) { let handle = rt_handle.io(); self.turn(hand...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
6871084629ad95c37c7136d865890ab2e371ea12
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/io/driver.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:5
// In case of wasm32_wasi this error happens, when trying to poll without subscriptions // just return from the park, as there would be nothing, which wakes us up. } Err(e) => panic!("unexpected error when polling the I/O driver: {:?}", e), } // Process all the e...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
6871084629ad95c37c7136d865890ab2e371ea12
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/io/driver.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:6
} } 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 //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
6871084629ad95c37c7136d865890ab2e371ea12
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/io/driver.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:7
&self, registration: &Arc<ScheduledIo>, source: &mut impl Source, ) -> io::Result<()> { // Deregister the source with the OS poller **first** self.registry.deregister(source)?; if self .registrations .deregister(&mut self.synced.lock(), registration) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
6871084629ad95c37c7136d865890ab2e371ea12
github
async-runtime
https://github.com/tokio-rs/tokio/blob/6871084629ad95c37c7136d865890ab2e371ea12/tokio/src/runtime/io/driver.rs
241
280
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:4
Ok((driver, handle)) } pub(crate) fn park(&mut self, rt_handle: &driver::Handle) { let handle = rt_handle.io(); self.turn(handle, None); } pub(crate) fn park_timeout(&mut self, rt_handle: &driver::Handle, duration: Duration) { let handle = rt_handle.io(); self.turn(hand...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
c445e467ce4363b3a9b6825268814a9bc27c0127
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c445e467ce4363b3a9b6825268814a9bc27c0127/tokio/src/runtime/io/driver.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:1
// Signal handling cfg_signal_internal_and_unix! { mod signal; } use crate::io::interest::Interest; use crate::io::ready::Ready; use crate::loom::sync::Mutex; use crate::runtime::driver; use crate::runtime::io::registration_set; use crate::runtime::io::{IoDriverMetrics, RegistrationSet, ScheduledIo}; use mio::eve...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
b573adc733dc4cbff7b125738e2708e2518cca16
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b573adc733dc4cbff7b125738e2708e2518cca16/tokio/src/runtime/io/driver.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:2
registrations: RegistrationSet, /// State that should be synchronized synced: Mutex<registration_set::Synced>, /// Used to wake up the reactor from a call to `turn`. /// Not supported on Wasi due to lack of threading support. #[cfg(not(tokio_wasi))] waker: mio::Waker, pub(crate) metrics: ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
b573adc733dc4cbff7b125738e2708e2518cca16
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b573adc733dc4cbff7b125738e2708e2518cca16/tokio/src/runtime/io/driver.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:3
Clear(u8), } const TOKEN_WAKEUP: mio::Token = mio::Token(0); const TOKEN_SIGNAL: mio::Token = mio::Token(1); fn _assert_kinds() { fn _assert<T: Send + Sync>() {} _assert::<Handle>(); } // ===== impl Driver ===== impl Driver { /// Creates a new event loop, returning any error that happened during the ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
b573adc733dc4cbff7b125738e2708e2518cca16
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b573adc733dc4cbff7b125738e2708e2518cca16/tokio/src/runtime/io/driver.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:4
Ok((driver, handle)) } pub(crate) fn park(&mut self, rt_handle: &driver::Handle) { let handle = rt_handle.io(); self.turn(handle, None); } pub(crate) fn park_timeout(&mut self, rt_handle: &driver::Handle, duration: Duration) { let handle = rt_handle.io(); self.turn(hand...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
b573adc733dc4cbff7b125738e2708e2518cca16
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b573adc733dc4cbff7b125738e2708e2518cca16/tokio/src/runtime/io/driver.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:5
// In case of wasm32_wasi this error happens, when trying to poll without subscriptions // just return from the park, as there would be nothing, which wakes us up. } Err(e) => panic!("unexpected error when polling the I/O driver: {:?}", e), } // Process all the e...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
b573adc733dc4cbff7b125738e2708e2518cca16
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b573adc733dc4cbff7b125738e2708e2518cca16/tokio/src/runtime/io/driver.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:6
} } 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 //...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
b573adc733dc4cbff7b125738e2708e2518cca16
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b573adc733dc4cbff7b125738e2708e2518cca16/tokio/src/runtime/io/driver.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:1
// Signal handling cfg_signal_internal_and_unix! { mod signal; } use crate::io::interest::Interest; use crate::io::ready::Ready; use crate::runtime::driver; use crate::runtime::io::{IoDriverMetrics, ScheduledIo}; use crate::util::slab::{self, Slab}; use crate::{loom::sync::RwLock, util::bit}; use std::fmt; use st...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
ce23db6bc7c6a2853377db629ca8b761a45e0476
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce23db6bc7c6a2853377db629ca8b761a45e0476/tokio/src/runtime/io/driver.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:2
/// 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 Wasi due to lack of threading support. #[cfg(not(tokio_wasi))] waker: mio::Waker, pub(crate) metrics: IoDriverMetrics,...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
ce23db6bc7c6a2853377db629ca8b761a45e0476
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce23db6bc7c6a2853377db629ca8b761a45e0476/tokio/src/runtime/io/driver.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:3
} pub(super) 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/driver.rs
MIT
ce23db6bc7c6a2853377db629ca8b761a45e0476
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce23db6bc7c6a2853377db629ca8b761a45e0476/tokio/src/runtime/io/driver.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:4
let allocator = slab.allocator(); let driver = Driver { tick: 0, signal_ready: false, events: mio::Events::with_capacity(nevents), poll, resources: slab, }; let handle = Handle { registry, io_dispatch: RwLock::...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
ce23db6bc7c6a2853377db629ca8b761a45e0476
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce23db6bc7c6a2853377db629ca8b761a45e0476/tokio/src/runtime/io/driver.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:5
} } 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 { self.resources.compact() ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
ce23db6bc7c6a2853377db629ca8b761a45e0476
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce23db6bc7c6a2853377db629ca8b761a45e0476/tokio/src/runtime/io/driver.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:6
self.tick, token, Ready::from_mio(event), ); ready_count += 1; } } handle.metrics.incr_ready_count_by(ready_count); } fn dispatch(resources: &mut Slab<ScheduledIo>, tick: u8, token: mio::Token, ready: Ready) { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
ce23db6bc7c6a2853377db629ca8b761a45e0476
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce23db6bc7c6a2853377db629ca8b761a45e0476/tokio/src/runtime/io/driver.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:7
/// 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/driver.rs
MIT
ce23db6bc7c6a2853377db629ca8b761a45e0476
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce23db6bc7c6a2853377db629ca8b761a45e0476/tokio/src/runtime/io/driver.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/driver.rs:8
/// shutdown the dispatcher. fn shutdown(&self) -> bool { let mut io = self.io_dispatch.write().unwrap(); if io.is_shutdown { return false; } io.is_shutdown = true; true } fn allocate(&self) -> io::Result<(slab::Address, slab::Ref<ScheduledIo>)> { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
ce23db6bc7c6a2853377db629ca8b761a45e0476
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce23db6bc7c6a2853377db629ca8b761a45e0476/tokio/src/runtime/io/driver.rs
281
332
tokio-rs/tokio:tokio/src/runtime/io/driver.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, } } }
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver.rs
MIT
ce23db6bc7c6a2853377db629ca8b761a45e0476
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce23db6bc7c6a2853377db629ca8b761a45e0476/tokio/src/runtime/io/driver.rs
321
332
tokio-rs/tokio:tokio/src/runtime/io/driver/signal.rs:1
use super::{Driver, Handle, TOKEN_SIGNAL}; use std::io; impl Handle { pub(crate) fn register_signal_receiver( &self, receiver: &mut mio::net::UnixStream, ) -> io::Result<()> { self.registry .register(receiver, TOKEN_SIGNAL, mio::Interest::READABLE)?; Ok(()) } } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/signal.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/driver/signal.rs
1
22
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:1
use io_uring::{squeue::Entry, IoUring, Probe}; use mio::unix::SourceFd; use slab::Slab; use crate::runtime::driver::op::CancelData; use crate::runtime::driver::op::CqeResult; use crate::runtime::driver::op::{Cancellable, Lifecycle}; use crate::{io::Interest, loom::sync::Mutex}; use super::{Handle, TOKEN_WAKEUP}; use...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/driver/uring.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:2
/// If the machine doesn't support io_uring, then this will return an /// `ENOSYS` error. pub(crate) fn try_init(&mut self, probe: &mut Probe) -> io::Result<bool> { if self.uring.is_some() { // Already initialized. return Ok(false); } let uring = IoUring::new(DEF...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/driver/uring.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:3
} Some(Lifecycle::Cancelled(cancel_data)) => { if let CancelData::Open(_) = cancel_data { if let Ok(fd) = CqeResult::from(cqe).result { // SAFETY: the successful CQE result provides // a non-negative inte...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/driver/uring.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:4
Err(e) => { return Err(e); } } } } pub(crate) fn remove_op(&mut self, index: usize) -> Lifecycle { self.ops.remove(index) } } /// Drop the driver, cancelling any in-progress ops and waiting for them to terminate. impl Drop for UringContext { ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/driver/uring.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:5
if let Ok(fd) = CqeResult::from(cqe).result { // SAFETY: the successful CQE result provides // a non-negative integer, and the event is // related to an open operation. unsafe { OwnedFd::from_raw_fd(fd as i32) }; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/driver/uring.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:6
#[cfg_attr(test, allow(dead_code))] pub(crate) fn is_uring_probed(&self) -> bool { self.uring_probe.get().is_some() } /// Check if the io_uring context is initialized. If not, it will try to initialize it. /// Then, check if the provided opcode is supported. /// /// If both the context ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/driver/uring.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:7
/// Initialize the io_uring context if it hasn't been initialized yet. fn try_init(&self, probe: &mut Probe) -> io::Result<()> { let mut guard = self.get_uring().lock(); if guard.try_init(probe)? { self.add_uring_source(guard.ring().as_raw_fd())?; } Ok(()) } ///...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/driver/uring.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:8
// SAFETY: entry is valid for the entire duration of the operation while unsafe { ctx.ring_mut().submission().push(&entry).is_err() } { // If the submission queue is full, flush it to the kernel submit_or_remove(ctx)?; } // Ensure that the completion queue is not full be...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/driver/uring.rs
281
329
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:5
if let Ok(fd) = CqeResult::from(cqe).result { // SAFETY: the successful CQE result provides // a non-negative integer, and the event is // related to an open operation. unsafe { OwnedFd::from_raw_fd(fd as i32) }; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
c79121391db8f8d36d4213feeb25381caee110c7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c79121391db8f8d36d4213feeb25381caee110c7/tokio/src/runtime/io/driver/uring.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:6
.get_or_try_init(|| async { let mut probe = Probe::new(); match self.try_init(&mut probe) { Ok(()) => Ok(Some(probe)), // If the system doesn't support io_uring, we set the probe to `None`. Err(e) if e.raw_os_error() == Some(lib...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
c79121391db8f8d36d4213feeb25381caee110c7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c79121391db8f8d36d4213feeb25381caee110c7/tokio/src/runtime/io/driver/uring.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:7
/// be valid for the entire duration of the operation, otherwise it may cause memory problems. pub(crate) unsafe fn register_op(&self, entry: Entry, waker: Waker) -> io::Result<usize> { assert!(self.uring_probe.initialized()); // Uring is initialized. let mut guard = self.get_uring().lock(...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
c79121391db8f8d36d4213feeb25381caee110c7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c79121391db8f8d36d4213feeb25381caee110c7/tokio/src/runtime/io/driver/uring.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:8
let ops = &mut ctx.ops; let Some(lifecycle) = ops.get_mut(index) else { // The corresponding index doesn't exist anymore, so this Op is already complete. return; }; // This Op will be cancelled. Here, we don't remove the lifecycle from the slab to keep // uring d...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
c79121391db8f8d36d4213feeb25381caee110c7
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c79121391db8f8d36d4213feeb25381caee110c7/tokio/src/runtime/io/driver/uring.rs
281
309
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:1
use io_uring::{squeue::Entry, IoUring, Probe}; use mio::unix::SourceFd; use slab::Slab; use crate::runtime::driver::op::{Cancellable, Lifecycle}; use crate::{io::Interest, loom::sync::Mutex}; use super::{Handle, TOKEN_WAKEUP}; use std::os::fd::{AsRawFd, RawFd}; use std::{io, mem, task::Waker}; const DEFAULT_RING_SI...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
7a2135f426ab560a9efb320620f80e1935c43d31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a2135f426ab560a9efb320620f80e1935c43d31/tokio/src/runtime/io/driver/uring.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:2
pub(crate) fn try_init(&mut self, probe: &mut Probe) -> io::Result<bool> { if self.uring.is_some() { // Already initialized. return Ok(false); } let uring = IoUring::new(DEFAULT_RING_SIZE)?; match uring.submitter().register_probe(probe) { Ok(_) => {}...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
7a2135f426ab560a9efb320620f80e1935c43d31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a2135f426ab560a9efb320620f80e1935c43d31/tokio/src/runtime/io/driver/uring.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:3
// Op future was cancelled, so we discard the result. // We just remove the entry from the slab. ops.remove(idx); } Some(other) => { panic!("unexpected lifecycle for slot {idx}: {other:?}"); } Non...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
7a2135f426ab560a9efb320620f80e1935c43d31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a2135f426ab560a9efb320620f80e1935c43d31/tokio/src/runtime/io/driver/uring.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:4
} } /// Drop the driver, cancelling any in-progress ops and waiting for them to terminate. impl Drop for UringContext { fn drop(&mut self) { if self.uring.is_none() { // Uring is not initialized or not supported. return; } // Make sure we flush the submission queue ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
7a2135f426ab560a9efb320620f80e1935c43d31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a2135f426ab560a9efb320620f80e1935c43d31/tokio/src/runtime/io/driver/uring.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:5
} pub(crate) fn get_uring(&self) -> &Mutex<UringContext> { &self.uring_context } /// Check if the io_uring context is initialized. If not, it will try to initialize it. /// Then, check if the provided opcode is supported. /// /// If both the context initialization succeeds and the opco...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
7a2135f426ab560a9efb320620f80e1935c43d31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a2135f426ab560a9efb320620f80e1935c43d31/tokio/src/runtime/io/driver/uring.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:6
} /// Initialize the io_uring context if it hasn't been initialized yet. fn try_init(&self, probe: &mut Probe) -> io::Result<()> { let mut guard = self.get_uring().lock(); if guard.try_init(probe)? { self.add_uring_source(guard.ring().as_raw_fd())?; } Ok(()) } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
7a2135f426ab560a9efb320620f80e1935c43d31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a2135f426ab560a9efb320620f80e1935c43d31/tokio/src/runtime/io/driver/uring.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:7
// SAFETY: entry is valid for the entire duration of the operation while unsafe { ctx.ring_mut().submission().push(&entry).is_err() } { // If the submission queue is full, flush it to the kernel submit_or_remove(ctx)?; } // Ensure that the completion queue is not full be...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
7a2135f426ab560a9efb320620f80e1935c43d31
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7a2135f426ab560a9efb320620f80e1935c43d31/tokio/src/runtime/io/driver/uring.rs
241
282
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:1
use io_uring::{squeue::Entry, IoUring, Probe}; use mio::unix::SourceFd; use slab::Slab; use crate::loom::sync::atomic::Ordering; use crate::runtime::driver::op::{Cancellable, Lifecycle}; use crate::{io::Interest, loom::sync::Mutex}; use super::{Handle, TOKEN_WAKEUP}; use std::os::fd::{AsRawFd, RawFd}; use std::{io, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0913cad381ead40ee194e881366bc136c8d8546c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0913cad381ead40ee194e881366bc136c8d8546c/tokio/src/runtime/io/driver/uring.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:2
pub(crate) probe: io_uring::Probe, pub(crate) ops: slab::Slab<Lifecycle>, } impl UringContext { pub(crate) fn new() -> Self { Self { ops: Slab::new(), uring: None, probe: Probe::new(), } } pub(crate) fn ring(&self) -> &io_uring::IoUring { sel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0913cad381ead40ee194e881366bc136c8d8546c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0913cad381ead40ee194e881366bc136c8d8546c/tokio/src/runtime/io/driver/uring.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:3
Err(e) if e.raw_os_error() == Some(libc::EINVAL) => { // The kernel does not support IORING_REGISTER_PROBE. return Err(io::Error::from_raw_os_error(libc::ENOSYS)); } Err(e) => return Err(e), } self.uring.replace(uring); Ok(true) } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0913cad381ead40ee194e881366bc136c8d8546c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0913cad381ead40ee194e881366bc136c8d8546c/tokio/src/runtime/io/driver/uring.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:4
} } self.uring.replace(uring); // `cq`'s drop gets called here, updating the latest head pointer } pub(crate) fn submit(&mut self) -> io::Result<()> { loop { // Errors from io_uring_enter: https://man7.org/linux/man-pages/man2/io_uring_enter.2.html#ERRORS ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0913cad381ead40ee194e881366bc136c8d8546c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0913cad381ead40ee194e881366bc136c8d8546c/tokio/src/runtime/io/driver/uring.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:5
// Make sure we flush the submission queue before dropping the driver. while !self.ring_mut().submission().is_empty() { self.submit().expect("Internal error when dropping driver"); } let mut ops = std::mem::take(&mut self.ops); // Remove all completed ops since we don't nee...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0913cad381ead40ee194e881366bc136c8d8546c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0913cad381ead40ee194e881366bc136c8d8546c/tokio/src/runtime/io/driver/uring.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:6
/// Check if the io_uring context is initialized. If not, it will try to initialize it. /// Then, check if the provided opcode is supported. /// /// If both the context initialization succeeds and the opcode is supported, /// this returns `Ok(true)`. /// If either io_uring is unsupported or the opco...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0913cad381ead40ee194e881366bc136c8d8546c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0913cad381ead40ee194e881366bc136c8d8546c/tokio/src/runtime/io/driver/uring.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:7
self.add_uring_source(guard.ring().as_raw_fd())?; } Ok(guard.is_opcode_supported(opcode)) } /// Register an operation with the io_uring. /// /// If this is the first io_uring operation, it will also initialize the io_uring context. /// If io_uring isn't supported, this function ret...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0913cad381ead40ee194e881366bc136c8d8546c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0913cad381ead40ee194e881366bc136c8d8546c/tokio/src/runtime/io/driver/uring.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:8
// If the submission queue is full, flush it to the kernel submit_or_remove(ctx)?; } // Ensure that the completion queue is not full before submitting the entry. while ctx.ring_mut().completion().is_full() { ctx.dispatch_completions(); } // Note: For now...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0913cad381ead40ee194e881366bc136c8d8546c
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0913cad381ead40ee194e881366bc136c8d8546c/tokio/src/runtime/io/driver/uring.rs
281
319
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:4
} } /// Drop the driver, cancelling any in-progress ops and waiting for them to terminate. impl Drop for UringContext { fn drop(&mut self) { if self.uring.is_none() { // Uring is not initialized or not supported. return; } // Make sure we flush the submission queue ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
ff9681b3c62d63ca2703976d4767f29442bc87f2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ff9681b3c62d63ca2703976d4767f29442bc87f2/tokio/src/runtime/io/driver/uring.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:5
} pub(crate) fn get_uring(&self) -> &Mutex<UringContext> { &self.uring_context } /// Check if the io_uring context is initialized. If not, it will try to initialize it. /// Then, check if the provided opcode is supported. /// /// If both the context initialization succeeds and the opco...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
ff9681b3c62d63ca2703976d4767f29442bc87f2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ff9681b3c62d63ca2703976d4767f29442bc87f2/tokio/src/runtime/io/driver/uring.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:6
} Ok(()) } /// Register an operation with the io_uring. /// /// If this is the first io_uring operation, it will also initialize the io_uring context. /// If io_uring isn't supported, this function returns an `ENOSYS` error, so the caller can /// perform custom handling, such as fallin...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
ff9681b3c62d63ca2703976d4767f29442bc87f2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ff9681b3c62d63ca2703976d4767f29442bc87f2/tokio/src/runtime/io/driver/uring.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:7
submit_or_remove(ctx)?; } // Ensure that the completion queue is not full before submitting the entry. while ctx.ring_mut().completion().is_full() { ctx.dispatch_completions(); } // Note: For now, we submit the entry immediately without utilizing batching. s...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
ff9681b3c62d63ca2703976d4767f29442bc87f2
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ff9681b3c62d63ca2703976d4767f29442bc87f2/tokio/src/runtime/io/driver/uring.rs
241
278
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:1
use io_uring::{squeue::Entry, IoUring}; use mio::unix::SourceFd; use slab::Slab; use crate::loom::sync::atomic::Ordering; use crate::runtime::driver::op::{Cancellable, Lifecycle}; use crate::{io::Interest, loom::sync::Mutex}; use super::{Handle, TOKEN_WAKEUP}; use std::os::fd::{AsRawFd, RawFd}; use std::{io, mem, ta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8/tokio/src/runtime/io/driver/uring.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:2
pub(crate) ops: slab::Slab<Lifecycle>, } impl UringContext { pub(crate) fn new() -> Self { Self { ops: Slab::new(), uring: None, } } pub(crate) fn ring(&self) -> &io_uring::IoUring { self.uring.as_ref().expect("io_uring not initialized") } pub(crate...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8/tokio/src/runtime/io/driver/uring.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:3
}; let cq = uring.completion(); for cqe in cq { let idx = cqe.user_data() as usize; match ops.get_mut(idx) { Some(Lifecycle::Waiting(waker)) => { waker.wake_by_ref(); *ops.get_mut(idx).unwrap() = Lifecycle::Completed(cqe)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8/tokio/src/runtime/io/driver/uring.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:4
Err(ref e) if e.raw_os_error() == Some(libc::EBUSY) => { self.dispatch_completions(); } // For other errors, we currently return the error as is. Err(e) => { return Err(e); } } } } pub(cr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8/tokio/src/runtime/io/driver/uring.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:5
for cqe in self.ring_mut().completion() { let idx = cqe.user_data() as usize; ops.remove(idx); } } } } impl Handle { fn add_uring_source(&self, uringfd: RawFd) -> io::Result<()> { let mut source = SourceFd(&uringfd); self.registry ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8/tokio/src/runtime/io/driver/uring.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:6
self.set_uring_state(State::Unsupported); Ok(false) } // For other system errors, we just return it. Err(e) => Err(e), }, State::Unsupported => Ok(false), State::Initialized => Ok(true), } } /// Init...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8/tokio/src/runtime/io/driver/uring.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:7
let ctx = &mut *guard; let index = ctx.ops.insert(Lifecycle::Waiting(waker)); let entry = entry.user_data(index as u64); let submit_or_remove = |ctx: &mut UringContext| -> io::Result<()> { if let Err(e) = ctx.submit() { // Submission failed, remove the entry from the...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8/tokio/src/runtime/io/driver/uring.rs
241
294
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:8
// uring data alive until the operation completes. let cancel_data = data.expect("Data should be present").cancel(); match mem::replace(lifecycle, Lifecycle::Cancelled(cancel_data)) { Lifecycle::Submitted | Lifecycle::Waiting(_) => (), // The driver saw the completion, but it wa...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8
github
async-runtime
https://github.com/tokio-rs/tokio/blob/2bf80f0ac6daaa28c0ad2c7d3ed1def59ae243e8/tokio/src/runtime/io/driver/uring.rs
281
294
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:5
for cqe in self.ring_mut().completion() { let idx = cqe.user_data() as usize; ops.remove(idx); } } } } impl Handle { fn add_uring_source(&self, uringfd: RawFd) -> io::Result<()> { let mut source = SourceFd(&uringfd); self.registry ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
3e84a198e4d6283f015965cd627ee5aaff69e022
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e84a198e4d6283f015965cd627ee5aaff69e022/tokio/src/runtime/io/driver/uring.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:6
State::Initialized => Ok(true), } } /// Initialize the io_uring context if it hasn't been initialized yet. fn try_init(&self) -> io::Result<()> { let mut guard = self.get_uring().lock(); if guard.try_init()? { self.add_uring_source(guard.ring().as_raw_fd())?; } ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
3e84a198e4d6283f015965cd627ee5aaff69e022
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e84a198e4d6283f015965cd627ee5aaff69e022/tokio/src/runtime/io/driver/uring.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:7
ctx.remove_op(index); return Err(e); } Ok(()) }; // SAFETY: entry is valid for the entire duration of the operation while unsafe { ctx.ring_mut().submission().push(&entry).is_err() } { // If the submission queue is full, flush it to the kernel...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
3e84a198e4d6283f015965cd627ee5aaff69e022
github
async-runtime
https://github.com/tokio-rs/tokio/blob/3e84a198e4d6283f015965cd627ee5aaff69e022/tokio/src/runtime/io/driver/uring.rs
241
287
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:4
Err(ref e) if e.raw_os_error() == Some(libc::EBUSY) => { self.dispatch_completions(); } // For other errors, we currently return the error as is. Err(e) => { return Err(e); } } } } pub(cr...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/src/runtime/io/driver/uring.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:5
} } for key in keys_to_move { let lifecycle = self.remove_op(key); cancel_ops.insert(lifecycle); } while !cancel_ops.is_empty() { // Wait until at least one completion is available. self.ring_mut() .submit_and_wait(1) ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/src/runtime/io/driver/uring.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:6
match State::from_usize(self.uring_state.load(Ordering::Acquire)) { State::Uninitialized => match self.try_init() { Ok(()) => { self.set_uring_state(State::Initialized); Ok(true) } // If the system doesn't support io_uri...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/src/runtime/io/driver/uring.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:7
// Note: Maybe this check can be removed if upstream callers consistently use `check_and_init`. if !self.check_and_init()? { return Err(io::Error::from_raw_os_error(libc::ENOSYS)); } // Uring is initialized. let mut guard = self.get_uring().lock(); let ctx = &mut *g...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/src/runtime/io/driver/uring.rs
241
299
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:8
// The corresponding index doesn't exist anymore, so this Op is already complete. return; }; // This Op will be cancelled. Here, we don't remove the lifecycle from the slab to keep // uring data alive until the operation completes. let cancel_data = data.expect("Data should...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0922aa2a0b09cf35582f15c799996c64e0b6e50a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0922aa2a0b09cf35582f15c799996c64e0b6e50a/tokio/src/runtime/io/driver/uring.rs
281
299
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:1
use io_uring::{squeue::Entry, IoUring}; use mio::unix::SourceFd; use slab::Slab; use crate::loom::sync::atomic::Ordering; use crate::runtime::driver::op::{Cancellable, Lifecycle}; use crate::{io::Interest, loom::sync::Mutex}; use super::{Handle, TOKEN_WAKEUP}; use std::os::fd::{AsRawFd, RawFd}; use std::{io, mem, ta...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0783797520cd04241901615e586bd0aa806aaad5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0783797520cd04241901615e586bd0aa806aaad5/tokio/src/runtime/io/driver/uring.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:2
pub(crate) ops: slab::Slab<Lifecycle>, } impl UringContext { pub(crate) fn new() -> Self { Self { ops: Slab::new(), uring: None, } } pub(crate) fn ring(&self) -> &io_uring::IoUring { self.uring.as_ref().expect("io_uring not initialized") } pub(crate...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0783797520cd04241901615e586bd0aa806aaad5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0783797520cd04241901615e586bd0aa806aaad5/tokio/src/runtime/io/driver/uring.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:3
}; let cq = uring.completion(); for cqe in cq { let idx = cqe.user_data() as usize; match ops.get_mut(idx) { Some(Lifecycle::Waiting(waker)) => { waker.wake_by_ref(); *ops.get_mut(idx).unwrap() = Lifecycle::Completed(cqe)...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0783797520cd04241901615e586bd0aa806aaad5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0783797520cd04241901615e586bd0aa806aaad5/tokio/src/runtime/io/driver/uring.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:7
// Note: Maybe this check can be removed if upstream callers consistently use `check_and_init`. if !self.check_and_init()? { return Err(io::Error::from_raw_os_error(libc::ENOSYS)); } // Uring is initialized. let mut guard = self.get_uring().lock(); let ctx = &mut *g...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0783797520cd04241901615e586bd0aa806aaad5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0783797520cd04241901615e586bd0aa806aaad5/tokio/src/runtime/io/driver/uring.rs
241
299
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:8
// The corresponding index doesn't exist anymore, so this Op is already complete. return; }; // This Op will be cancelled. Here, we don't remove the lifecycle from the slab to keep // uring data alive until the operation completes. let cancel_data = data.expect("Data should...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
0783797520cd04241901615e586bd0aa806aaad5
github
async-runtime
https://github.com/tokio-rs/tokio/blob/0783797520cd04241901615e586bd0aa806aaad5/tokio/src/runtime/io/driver/uring.rs
281
299
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:7
// Note: Maybe this check can be removed if upstream callers consistently use `check_and_init`. if !self.check_and_init()? { return Err(io::Error::from_raw_os_error(libc::ENOSYS)); } // Uring is initialized. let mut guard = self.get_uring().lock(); let ctx = &mut *g...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
9f848c9f544a87f52ca406bad895a2b0ffa10e4b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9f848c9f544a87f52ca406bad895a2b0ffa10e4b/tokio/src/runtime/io/driver/uring.rs
241
296
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:8
// The corresponding index doesn't exist anymore, so this Op is already complete. return; }; // This Op will be cancelled. Here, we don't remove the lifecycle from the slab to keep // uring data alive until the operation completes. let cancel_data = data.expect("Data should...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
9f848c9f544a87f52ca406bad895a2b0ffa10e4b
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9f848c9f544a87f52ca406bad895a2b0ffa10e4b/tokio/src/runtime/io/driver/uring.rs
281
296
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:1
use io_uring::{squeue::Entry, IoUring}; use mio::unix::SourceFd; use slab::Slab; use crate::runtime::driver::op::{Cancellable, Lifecycle}; use crate::{io::Interest, loom::sync::Mutex}; use super::{Handle, TOKEN_WAKEUP}; use std::os::fd::AsRawFd; use std::{io, mem, task::Waker}; const DEFAULT_RING_SIZE: u32 = 256; ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
327bec2caf92af5e2732f8fdfe2e4a20d349f67e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/327bec2caf92af5e2732f8fdfe2e4a20d349f67e/tokio/src/runtime/io/driver/uring.rs
1
60
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:2
Some(Lifecycle::Cancelled(_)) => { // Op future was cancelled, so we discard the result. // We just remove the entry from the slab. ops.remove(idx); } Some(other) => { panic!("unexpected lifecycle for slot {}...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
327bec2caf92af5e2732f8fdfe2e4a20d349f67e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/327bec2caf92af5e2732f8fdfe2e4a20d349f67e/tokio/src/runtime/io/driver/uring.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:3
} /// Drop the driver, cancelling any in-progress ops and waiting for them to terminate. impl Drop for UringContext { fn drop(&mut self) { // Make sure we flush the submission queue before dropping the driver. while !self.uring.submission().is_empty() { self.submit().expect("Internal er...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
327bec2caf92af5e2732f8fdfe2e4a20d349f67e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/327bec2caf92af5e2732f8fdfe2e4a20d349f67e/tokio/src/runtime/io/driver/uring.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:4
} } impl Handle { #[allow(dead_code)] pub(crate) fn add_uring_source(&self, interest: Interest) -> io::Result<()> { // setup for io_uring let uringfd = self.get_uring().lock().uring.as_raw_fd(); let mut source = SourceFd(&uringfd); self.registry .register(&mut source...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
327bec2caf92af5e2732f8fdfe2e4a20d349f67e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/327bec2caf92af5e2732f8fdfe2e4a20d349f67e/tokio/src/runtime/io/driver/uring.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/driver/uring.rs:5
} // Note: For now, we submit the entry immediately without utilizing batching. submit_or_remove(ctx)?; Ok(index) } // TODO: Remove this annotation when operations are actually supported #[allow(unused_variables, unreachable_code)] pub(crate) fn cancel_op<T: Cancellable>(&self...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/driver/uring.rs
MIT
327bec2caf92af5e2732f8fdfe2e4a20d349f67e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/327bec2caf92af5e2732f8fdfe2e4a20d349f67e/tokio/src/runtime/io/driver/uring.rs
161
191
tokio-rs/tokio:tokio/src/runtime/io/metrics.rs:1
//! This file contains mocks of the metrics types used in the I/O driver. //! //! The reason these mocks don't live in `src/runtime/mock.rs` is because //! these need to be available in the case when `net` is enabled but //! `rt` is not. cfg_not_rt_and_metrics_and_net! { #[derive(Default)] pub(crate) struct Io...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/metrics.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/metrics.rs
1
24
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:1
#![cfg_attr( not(all(feature = "rt", feature = "net", feature = "io-uring", tokio_unstable)), allow(dead_code) )] mod driver; use driver::{Direction, Tick}; pub(crate) use driver::{Driver, Handle, ReadyEvent}; mod registration; pub(crate) use registration::Registration; mod registration_set; use registration_...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17
github
async-runtime
https://github.com/tokio-rs/tokio/blob/c6d58ce7e7bf4a6e7e6efc1ffeb42daa3a627c17/tokio/src/runtime/io/mod.rs
1
22
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:1
#![cfg_attr( not(all(feature = "rt", feature = "net", tokio_uring)), allow(dead_code) )] mod driver; use driver::{Direction, Tick}; pub(crate) use driver::{Driver, Handle, ReadyEvent}; mod registration; pub(crate) use registration::Registration; mod registration_set; use registration_set::RegistrationSet; mo...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
327bec2caf92af5e2732f8fdfe2e4a20d349f67e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/327bec2caf92af5e2732f8fdfe2e4a20d349f67e/tokio/src/runtime/io/mod.rs
1
22
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:1
#![cfg_attr(not(all(feature = "rt", feature = "net")), allow(dead_code))] mod driver; use driver::{Direction, Tick}; pub(crate) use driver::{Driver, Handle, ReadyEvent}; mod registration; pub(crate) use registration::Registration; mod registration_set; use registration_set::RegistrationSet; mod scheduled_io; use sch...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
21cf5a546916b612931d764b3ce2bb7d4412021e
github
async-runtime
https://github.com/tokio-rs/tokio/blob/21cf5a546916b612931d764b3ce2bb7d4412021e/tokio/src/runtime/io/mod.rs
1
19
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:1
#![cfg_attr(not(all(feature = "rt", feature = "net")), allow(dead_code))] mod driver; use driver::{Direction, Tick}; pub(crate) use driver::{Driver, Handle, ReadyEvent}; mod registration; pub(crate) use registration::Registration; mod registration_set; use registration_set::RegistrationSet; mod scheduled_io; use sch...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
b573adc733dc4cbff7b125738e2708e2518cca16
github
async-runtime
https://github.com/tokio-rs/tokio/blob/b573adc733dc4cbff7b125738e2708e2518cca16/tokio/src/runtime/io/mod.rs
1
16
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:1
#![cfg_attr(not(all(feature = "rt", feature = "net")), allow(dead_code))] mod driver; use driver::{Direction, Tick}; pub(crate) use driver::{Driver, Handle, ReadyEvent}; mod registration; pub(crate) use registration::Registration; mod scheduled_io; use scheduled_io::ScheduledIo; mod metrics; use metrics::IoDriverMet...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
ce23db6bc7c6a2853377db629ca8b761a45e0476
github
async-runtime
https://github.com/tokio-rs/tokio/blob/ce23db6bc7c6a2853377db629ca8b761a45e0476/tokio/src/runtime/io/mod.rs
1
13
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
7b24b22901f8fc89c1b5f7989d4c2482cd4f288a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b24b22901f8fc89c1b5f7989d4c2482cd4f288a/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. 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
7b24b22901f8fc89c1b5f7989d4c2482cd4f288a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b24b22901f8fc89c1b5f7989d4c2482cd4f288a/tokio/src/runtime/io/mod.rs
41
100
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:3
} #[derive(Debug, Eq, PartialEq, Clone, Copy)] enum Direction { Read, 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 ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
7b24b22901f8fc89c1b5f7989d4c2482cd4f288a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b24b22901f8fc89c1b5f7989d4c2482cd4f288a/tokio/src/runtime/io/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:4
let poll = mio::Poll::new()?; #[cfg(not(tokio_wasi))] let waker = mio::Waker::new(poll.registry(), TOKEN_WAKEUP)?; let registry = poll.registry().try_clone()?; let slab = Slab::new(); let allocator = slab.allocator(); let driver = Driver { tick: 0, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
7b24b22901f8fc89c1b5f7989d4c2482cd4f288a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b24b22901f8fc89c1b5f7989d4c2482cd4f288a/tokio/src/runtime/io/mod.rs
121
180
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:5
if handle.shutdown() { self.resources.for_each(|io| { // If a task is waiting on the I/O resource, notify it that the // runtime is being shutdown. And shutdown will clear all wakers. io.shutdown(); }); } } fn turn(&mut self, handl...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
7b24b22901f8fc89c1b5f7989d4c2482cd4f288a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b24b22901f8fc89c1b5f7989d4c2482cd4f288a/tokio/src/runtime/io/mod.rs
161
220
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:6
// 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, token, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
7b24b22901f8fc89c1b5f7989d4c2482cd4f288a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b24b22901f8fc89c1b5f7989d4c2482cd4f288a/tokio/src/runtime/io/mod.rs
201
260
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:7
} 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 /// ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
7b24b22901f8fc89c1b5f7989d4c2482cd4f288a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b24b22901f8fc89c1b5f7989d4c2482cd4f288a/tokio/src/runtime/io/mod.rs
241
300
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:8
self.metrics.dec_fd_count(); Ok(()) } /// shutdown the dispatcher. fn shutdown(&self) -> bool { let mut io = self.io_dispatch.write().unwrap(); if io.is_shutdown { return false; } io.is_shutdown = true; true } fn allocate(&self) -> io::R...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
7b24b22901f8fc89c1b5f7989d4c2482cd4f288a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b24b22901f8fc89c1b5f7989d4c2482cd4f288a/tokio/src/runtime/io/mod.rs
281
340
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:9
impl IoDispatcher { fn new(allocator: slab::Allocator<ScheduledIo>) -> Self { Self { allocator, is_shutdown: false, } } } impl Direction { pub(super) fn mask(self) -> Ready { match self { Direction::Read => Ready::READABLE | Ready::READ_CLOSED, ...
rust
rust
rust-source
tokio-rs/tokio
tokio/src/runtime/io/mod.rs
MIT
7b24b22901f8fc89c1b5f7989d4c2482cd4f288a
github
async-runtime
https://github.com/tokio-rs/tokio/blob/7b24b22901f8fc89c1b5f7989d4c2482cd4f288a/tokio/src/runtime/io/mod.rs
321
356
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
9af2f5ee5931a79684d4afd8897e54aafa39c156
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9af2f5ee5931a79684d4afd8897e54aafa39c156/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
9af2f5ee5931a79684d4afd8897e54aafa39c156
github
async-runtime
https://github.com/tokio-rs/tokio/blob/9af2f5ee5931a79684d4afd8897e54aafa39c156/tokio/src/runtime/io/mod.rs
81
140
tokio-rs/tokio:tokio/src/runtime/io/mod.rs:4
poll, resources: slab, }; let handle = Handle { registry, io_dispatch: RwLock::new(IoDispatcher::new(allocator)), #[cfg(not(tokio_wasi))] waker, metrics: IoDriverMetrics::default(), }; Ok((driver, handle)) } ...
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
121
180