repo
stringlengths
6
65
file_url
stringlengths
81
311
file_path
stringlengths
6
227
content
stringlengths
0
32.8k
language
stringclasses
1 value
license
stringclasses
7 values
commit_sha
stringlengths
40
40
retrieved_at
stringdate
2026-01-04 15:31:58
2026-01-04 20:25:31
truncated
bool
2 classes
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/scheduler/multi_thread/worker.rs
tokio/src/runtime/scheduler/multi_thread/worker.rs
//! A scheduler is initialized with a fixed number of workers. Each worker is //! driven by a thread. Each worker has a "core" which contains data such as the //! run queue and other state. When `block_in_place` is called, the worker's //! "core" is handed off to a new thread allowing the scheduler to continue to //! m...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
true
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/scheduler/multi_thread/trace_mock.rs
tokio/src/runtime/scheduler/multi_thread/trace_mock.rs
pub(super) struct TraceStatus {} impl TraceStatus { pub(super) fn new(_: usize) -> Self { Self {} } pub(super) fn trace_requested(&self) -> bool { false } }
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/scheduler/multi_thread/mod.rs
tokio/src/runtime/scheduler/multi_thread/mod.rs
//! Multi-threaded runtime mod counters; use counters::Counters; mod handle; pub(crate) use handle::Handle; mod overflow; pub(crate) use overflow::Overflow; mod idle; use self::idle::Idle; mod stats; pub(crate) use stats::Stats; mod park; pub(crate) use park::{Parker, Unparker}; pub(crate) mod queue; mod worker...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/scheduler/multi_thread/queue.rs
tokio/src/runtime/scheduler/multi_thread/queue.rs
//! Run-queue structures to support a work-stealing scheduler use crate::loom::cell::UnsafeCell; use crate::loom::sync::Arc; use crate::runtime::scheduler::multi_thread::{Overflow, Stats}; use crate::runtime::task; use std::mem::{self, MaybeUninit}; use std::ptr; use std::sync::atomic::Ordering::{AcqRel, Acquire, Rel...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/scheduler/multi_thread/handle.rs
tokio/src/runtime/scheduler/multi_thread/handle.rs
use crate::future::Future; use crate::loom::sync::Arc; use crate::runtime::scheduler::multi_thread::worker; use crate::runtime::task::{Notified, Task, TaskHarnessScheduleHooks}; use crate::runtime::{ blocking, driver, task::{self, JoinHandle, SpawnLocation}, TaskHooks, TaskMeta, TimerFlavor, }; use crate::u...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/scheduler/multi_thread/worker/taskdump_mock.rs
tokio/src/runtime/scheduler/multi_thread/worker/taskdump_mock.rs
use super::{Core, Handle}; impl Handle { pub(super) fn trace_core(&self, core: Box<Core>) -> Box<Core> { core } }
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/scheduler/multi_thread/worker/taskdump.rs
tokio/src/runtime/scheduler/multi_thread/worker/taskdump.rs
use super::{Core, Handle, Shared}; use crate::loom::sync::Arc; use crate::runtime::scheduler::multi_thread::Stats; use crate::runtime::task::trace::trace_multi_thread; use crate::runtime::{dump, WorkerMetrics}; use std::time::Duration; impl Handle { pub(super) fn trace_core(&self, mut core: Box<Core>) -> Box<Cor...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/scheduler/multi_thread/worker/metrics.rs
tokio/src/runtime/scheduler/multi_thread/worker/metrics.rs
use super::Shared; impl Shared { pub(crate) fn injection_queue_depth(&self) -> usize { self.inject.len() } } cfg_unstable_metrics! { impl Shared { pub(crate) fn worker_local_queue_depth(&self, worker: usize) -> usize { self.remotes[worker].steal.len() } } }
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/scheduler/multi_thread/handle/taskdump.rs
tokio/src/runtime/scheduler/multi_thread/handle/taskdump.rs
use super::Handle; use crate::runtime::Dump; impl Handle { pub(crate) async fn dump(&self) -> Dump { let trace_status = &self.shared.trace_status; // If a dump is in progress, block. trace_status.start_trace_request(self).await; let result = loop { if let Some(result)...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/scheduler/multi_thread/handle/metrics.rs
tokio/src/runtime/scheduler/multi_thread/handle/metrics.rs
use super::Handle; use crate::runtime::WorkerMetrics; cfg_unstable_metrics! { use crate::runtime::SchedulerMetrics; } impl Handle { pub(crate) fn num_workers(&self) -> usize { self.shared.worker_metrics.len() } pub(crate) fn num_alive_tasks(&self) -> usize { self.shared.owned.num_aliv...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/blocking/shutdown.rs
tokio/src/runtime/blocking/shutdown.rs
//! A shutdown channel. //! //! Each worker holds the `Sender` half. When all the `Sender` halves are //! dropped, the `Receiver` receives a notification. use crate::loom::sync::Arc; use crate::sync::oneshot; use std::time::Duration; #[derive(Debug, Clone)] pub(super) struct Sender { _tx: Arc<oneshot::Sender<()>...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/blocking/schedule.rs
tokio/src/runtime/blocking/schedule.rs
#[cfg(feature = "test-util")] use crate::runtime::scheduler; use crate::runtime::task::{self, Task, TaskHarnessScheduleHooks}; use crate::runtime::Handle; /// `task::Schedule` implementation that does nothing (except some bookkeeping /// in test-util builds). This is unique to the blocking scheduler as tasks /// sched...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/blocking/mod.rs
tokio/src/runtime/blocking/mod.rs
//! Abstracts out the APIs necessary to `Runtime` for integrating the blocking //! pool. When the `blocking` feature flag is **not** enabled, these APIs are //! shells. This isolates the complexity of dealing with conditional //! compilation. mod pool; pub(crate) use pool::{spawn_blocking, BlockingPool, Spawner}; cfg...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/blocking/task.rs
tokio/src/runtime/blocking/task.rs
use std::future::Future; use std::pin::Pin; use std::task::{Context, Poll}; /// Converts a function to a future that completes on poll. pub(crate) struct BlockingTask<T> { func: Option<T>, } impl<T> BlockingTask<T> { /// Initializes a new blocking task from the given function. pub(crate) fn new(func: T) -...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/blocking/pool.rs
tokio/src/runtime/blocking/pool.rs
//! Thread pool for blocking operations use crate::loom::sync::{Arc, Condvar, Mutex}; use crate::loom::thread; use crate::runtime::blocking::schedule::BlockingSchedule; use crate::runtime::blocking::{shutdown, BlockingTask}; use crate::runtime::builder::ThreadNameFn; use crate::runtime::task::{self, JoinHandle}; use c...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/local_runtime/runtime.rs
tokio/src/runtime/local_runtime/runtime.rs
#![allow(irrefutable_let_patterns)] use crate::runtime::blocking::BlockingPool; use crate::runtime::scheduler::CurrentThread; use crate::runtime::{context, Builder, EnterGuard, Handle, BOX_FUTURE_THRESHOLD}; use crate::task::JoinHandle; use crate::util::trace::SpawnMeta; use std::future::Future; use std::marker::Phan...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/local_runtime/options.rs
tokio/src/runtime/local_runtime/options.rs
use std::marker::PhantomData; /// [`LocalRuntime`]-only config options /// /// Currently, there are no such options, but in the future, things like `!Send + !Sync` hooks may /// be added. /// /// Use `LocalOptions::default()` to create the default set of options. This type is used with /// [`Builder::build_local`]. //...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/local_runtime/mod.rs
tokio/src/runtime/local_runtime/mod.rs
mod runtime; mod options; pub use options::LocalOptions; pub use runtime::LocalRuntime; pub(super) use runtime::LocalRuntimeScheduler;
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/signal/mod.rs
tokio/src/runtime/signal/mod.rs
#![cfg_attr(not(feature = "rt"), allow(dead_code))] //! Signal driver use crate::runtime::{driver, io}; use crate::signal::registry::globals; use mio::net::UnixStream; use std::io::{self as std_io, Read}; use std::sync::{Arc, Weak}; use std::time::Duration; /// Responsible for registering wakeups when an OS signal ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/id.rs
tokio/src/runtime/task/id.rs
use crate::runtime::context; use std::{fmt, num::NonZeroU64}; /// An opaque ID that uniquely identifies a task relative to all other currently /// running tasks. /// /// A task's ID may be re-used for another task only once *both* of the /// following happen: /// 1. The task itself exits. /// 2. There is no active [`...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/list.rs
tokio/src/runtime/task/list.rs
//! This module has containers for storing the tasks spawned on a scheduler. The //! `OwnedTasks` container is thread-safe but can only store tasks that //! implement Send. The `LocalOwnedTasks` container is not thread safe, but can //! store non-Send tasks. //! //! The collections can be closed to prevent adding new t...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/state.rs
tokio/src/runtime/task/state.rs
use crate::loom::sync::atomic::AtomicUsize; use std::fmt; use std::sync::atomic::Ordering::{AcqRel, Acquire, Release}; pub(super) struct State { val: AtomicUsize, } /// Current state value. #[derive(Copy, Clone)] pub(super) struct Snapshot(usize); type UpdateResult = Result<Snapshot, Snapshot>; /// The task is...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/core.rs
tokio/src/runtime/task/core.rs
//! Core task module. //! //! # Safety //! //! The functions in this module are private to the `task` module. All of them //! should be considered `unsafe` to use, but are not marked as such since it //! would be too noisy. //! //! Make sure to consult the relevant safety section of each function before //! use. // It...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/error.rs
tokio/src/runtime/task/error.rs
use std::any::Any; use std::fmt; use std::io; use super::Id; use crate::util::SyncWrapper; cfg_rt! { /// Task failed to execute to completion. pub struct JoinError { repr: Repr, id: Id, } } enum Repr { Cancelled, Panic(SyncWrapper<Box<dyn Any + Send + 'static>>), } impl JoinError ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/raw.rs
tokio/src/runtime/task/raw.rs
// It doesn't make sense to enforce `unsafe_op_in_unsafe_fn` for this module because // // * This module is doing the low-level task management that requires tons of unsafe // operations. // * Excessive `unsafe {}` blocks hurt readability significantly. // TODO: replace with `#[expect(unsafe_op_in_unsafe_fn)]` after ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/mod.rs
tokio/src/runtime/task/mod.rs
//! The task module. //! //! The task module contains the code that manages spawned tasks and provides a //! safe API for the rest of the runtime to use. Each task in a runtime is //! stored in an `OwnedTasks` or `LocalOwnedTasks` object. //! //! # Task reference types //! //! A task is usually referenced by multiple h...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/join.rs
tokio/src/runtime/task/join.rs
use crate::runtime::task::{AbortHandle, Header, RawTask}; use std::fmt; use std::future::Future; use std::marker::PhantomData; use std::panic::{RefUnwindSafe, UnwindSafe}; use std::pin::Pin; use std::task::{ready, Context, Poll, Waker}; cfg_rt! { /// An owned permission to join on a task (await its termination). ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/waker.rs
tokio/src/runtime/task/waker.rs
use crate::runtime::task::{Header, RawTask, Schedule}; use std::marker::PhantomData; use std::mem::ManuallyDrop; use std::ops; use std::ptr::NonNull; use std::task::{RawWaker, RawWakerVTable, Waker}; pub(super) struct WakerRef<'a, S: 'static> { waker: ManuallyDrop<Waker>, _p: PhantomData<(&'a Header, S)>, } ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/abort.rs
tokio/src/runtime/task/abort.rs
use crate::runtime::task::{Header, RawTask}; use std::fmt; use std::panic::{RefUnwindSafe, UnwindSafe}; /// An owned permission to abort a spawned task, without awaiting its completion. /// /// Unlike a [`JoinHandle`], an `AbortHandle` does *not* represent the /// permission to await the task's completion, only to ter...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/harness.rs
tokio/src/runtime/task/harness.rs
use crate::future::Future; use crate::runtime::task::core::{Cell, Core, Header, Trailer}; use crate::runtime::task::state::{Snapshot, State}; use crate::runtime::task::waker::waker_ref; use crate::runtime::task::{Id, JoinError, Notified, RawTask, Schedule, Task}; #[cfg(tokio_unstable)] use crate::runtime::TaskMeta; us...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/trace/tree.rs
tokio/src/runtime/task/trace/tree.rs
use std::collections::{hash_map::DefaultHasher, HashMap, HashSet}; use std::fmt; use std::hash::{Hash, Hasher}; use super::{Backtrace, Symbol, SymbolTrace, Trace}; /// An adjacency list representation of an execution tree. /// /// This tree provides a convenient intermediate representation for formatting /// [`Trace`...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/trace/mod.rs
tokio/src/runtime/task/trace/mod.rs
use crate::loom::sync::Arc; use crate::runtime::context; use crate::runtime::scheduler::{self, current_thread, Inject}; use crate::task::Id; use backtrace::BacktraceFrame; use std::cell::Cell; use std::collections::VecDeque; use std::ffi::c_void; use std::fmt; use std::future::Future; use std::pin::Pin; use std::ptr::...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/task/trace/symbol.rs
tokio/src/runtime/task/trace/symbol.rs
use backtrace::BacktraceSymbol; use std::fmt; use std::hash::{Hash, Hasher}; use std::ptr; /// A symbol in a backtrace. /// /// This wrapper type serves two purposes. The first is that it provides a /// representation of a symbol that can be inserted into hashmaps and hashsets; /// the [`backtrace`] crate does not def...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/io/scheduled_io.rs
tokio/src/runtime/io/scheduled_io.rs
use crate::io::interest::Interest; use crate::io::ready::Ready; use crate::loom::sync::atomic::AtomicUsize; use crate::loom::sync::Mutex; use crate::runtime::io::{Direction, ReadyEvent, Tick}; use crate::util::bit; use crate::util::linked_list::{self, LinkedList}; use crate::util::WakeList; use std::cell::UnsafeCell; ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/io/registration_set.rs
tokio/src/runtime/io/registration_set.rs
use crate::loom::sync::atomic::AtomicUsize; use crate::runtime::io::ScheduledIo; use crate::util::linked_list::{self, LinkedList}; use std::io; use std::ptr::NonNull; use std::sync::atomic::Ordering::{Acquire, Release}; use std::sync::Arc; // Kind of arbitrary, but buffering 16 `ScheduledIo`s doesn't seem like much c...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/io/mod.rs
tokio/src/runtime/io/mod.rs
#![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
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/io/metrics.rs
tokio/src/runtime/io/metrics.rs
//! 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
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/io/registration.rs
tokio/src/runtime/io/registration.rs
#![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
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/io/driver.rs
tokio/src/runtime/io/driver.rs
// Signal handling cfg_signal_internal_and_unix! { mod signal; } cfg_io_uring! { mod uring; use uring::UringContext; use crate::loom::sync::atomic::AtomicUsize; } use crate::io::interest::Interest; use crate::io::ready::Ready; use crate::loom::sync::Mutex; use crate::runtime::driver; use crate::runtime...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/io/driver/signal.rs
tokio/src/runtime/io/driver/signal.rs
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
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/io/driver/uring.rs
tokio/src/runtime/io/driver/uring.rs
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
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/driver/op.rs
tokio/src/runtime/driver/op.rs
use crate::io::uring::open::Open; use crate::io::uring::read::Read; use crate::io::uring::write::Write; use crate::runtime::Handle; use io_uring::cqueue; use io_uring::squeue::Entry; use std::future::Future; use std::io::{self, Error}; use std::mem; use std::pin::Pin; use std::task::{Context, Poll, Waker}; // This fi...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/context/blocking.rs
tokio/src/runtime/context/blocking.rs
use super::{EnterRuntime, CONTEXT}; use crate::loom::thread::AccessError; use crate::util::markers::NotSendOrSync; use std::marker::PhantomData; use std::time::Duration; /// Guard tracking that a caller has entered a blocking region. #[must_use] pub(crate) struct BlockingRegionGuard { _p: PhantomData<NotSendOrSy...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/context/scoped.rs
tokio/src/runtime/context/scoped.rs
use std::cell::Cell; use std::ptr; /// Scoped thread-local storage pub(super) struct Scoped<T> { pub(super) inner: Cell<*const T>, } impl<T> Scoped<T> { pub(super) const fn new() -> Scoped<T> { Scoped { inner: Cell::new(ptr::null()), } } /// Inserts a value into the scoped...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/context/runtime_mt.rs
tokio/src/runtime/context/runtime_mt.rs
use super::{EnterRuntime, CONTEXT}; /// Returns true if in a runtime context. pub(crate) fn current_enter_context() -> EnterRuntime { CONTEXT.with(|c| c.runtime.get()) } /// Forces the current "entered" state to be cleared while the closure /// is executed. pub(crate) fn exit_runtime<F: FnOnce() -> R, R>(f: F) ->...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/context/runtime.rs
tokio/src/runtime/context/runtime.rs
use super::{BlockingRegionGuard, SetCurrentGuard, CONTEXT}; use crate::runtime::scheduler; use crate::util::rand::{FastRand, RngSeed}; use std::fmt; #[derive(Debug, Clone, Copy)] #[must_use] pub(crate) enum EnterRuntime { /// Currently in a runtime context. #[cfg_attr(not(feature = "rt"), allow(dead_code))] ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/context/current.rs
tokio/src/runtime/context/current.rs
use super::{Context, CONTEXT}; use crate::runtime::{scheduler, TryCurrentError}; use crate::util::markers::SyncNotSend; use std::cell::{Cell, RefCell}; use std::marker::PhantomData; #[derive(Debug)] #[must_use] pub(crate) struct SetCurrentGuard { // The previous handle prev: Option<scheduler::Handle>, /...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/time_alt/tests.rs
tokio/src/runtime/time_alt/tests.rs
use super::*; use crate::loom::thread; use futures_test::task::{new_count_waker, AwokenCount}; #[cfg(loom)] const NUM_ITEMS: usize = 16; #[cfg(not(loom))] const NUM_ITEMS: usize = 64; fn new_handle() -> (EntryHandle, AwokenCount) { let (waker, count) = new_count_waker(); (EntryHandle::new(0, waker), count) ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/time_alt/wake_queue.rs
tokio/src/runtime/time_alt/wake_queue.rs
use super::{Entry, EntryHandle, WakeQueueEntry}; use crate::util::linked_list; type EntryList = linked_list::LinkedList<WakeQueueEntry, Entry>; /// A queue of entries that need to be woken up. #[derive(Debug)] pub(crate) struct WakeQueue { list: EntryList, } impl Drop for WakeQueue { fn drop(&mut self) { ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/time_alt/timer.rs
tokio/src/runtime/time_alt/timer.rs
use super::{EntryHandle, TempLocalContext}; use crate::runtime::scheduler::Handle as SchedulerHandle; use crate::time::Instant; use std::pin::Pin; use std::task::{Context, Poll}; #[cfg(any(feature = "rt", feature = "rt-multi-thread"))] use crate::util::error::RUNTIME_SHUTTING_DOWN_ERROR; pub(crate) struct Timer { ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/time_alt/mod.rs
tokio/src/runtime/time_alt/mod.rs
pub(crate) mod context; pub(super) use context::{LocalContext, TempLocalContext}; pub(crate) mod cancellation_queue; mod entry; pub(crate) use entry::Handle as EntryHandle; use entry::{CancellationQueueEntry, RegistrationQueueEntry, WakeQueueEntry}; use entry::{Entry, EntryList}; mod registration_queue; pub(crate) u...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/time_alt/cancellation_queue.rs
tokio/src/runtime/time_alt/cancellation_queue.rs
use super::{CancellationQueueEntry, Entry, EntryHandle}; use crate::loom::sync::{Arc, Mutex}; use crate::util::linked_list; type EntryList = linked_list::LinkedList<CancellationQueueEntry, Entry>; #[derive(Debug, Default)] struct Inner { list: EntryList, } impl Drop for Inner { fn drop(&mut self) { /...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/time_alt/context.rs
tokio/src/runtime/time_alt/context.rs
use super::{cancellation_queue, RegistrationQueue, Wheel}; /// Local context for the time driver, used when the runtime wants to /// fire/cancel timers. pub(crate) struct LocalContext { pub(crate) wheel: Wheel, pub(crate) registration_queue: RegistrationQueue, pub(crate) canc_tx: cancellation_queue::Sender...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/time_alt/registration_queue.rs
tokio/src/runtime/time_alt/registration_queue.rs
use super::{Entry, EntryHandle, RegistrationQueueEntry}; use crate::util::linked_list; type EntryList = linked_list::LinkedList<RegistrationQueueEntry, Entry>; /// A queue of entries that need to be registered in the timer wheel. #[derive(Debug)] pub(crate) struct RegistrationQueue { list: EntryList, } impl Drop...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/time_alt/entry.rs
tokio/src/runtime/time_alt/entry.rs
use super::cancellation_queue::Sender; use crate::loom::sync::{Arc, Mutex}; use crate::util::linked_list; use std::marker::PhantomPinned; use std::ptr::NonNull; use std::task::Waker; pub(super) type EntryList = linked_list::LinkedList<Entry, Entry>; #[derive(Debug)] struct State { cancelled: bool, woken_up: ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/time_alt/cancellation_queue/tests.rs
tokio/src/runtime/time_alt/cancellation_queue/tests.rs
use super::*; use futures::task::noop_waker; #[cfg(loom)] const NUM_ITEMS: usize = 16; #[cfg(not(loom))] const NUM_ITEMS: usize = 64; fn new_handle() -> EntryHandle { EntryHandle::new(0, noop_waker()) } fn model<F: Fn() + Send + Sync + 'static>(f: F) { #[cfg(loom)] loom::model(f); #[cfg(not(loom))...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/time_alt/wake_queue/tests.rs
tokio/src/runtime/time_alt/wake_queue/tests.rs
use super::*; use futures_test::task::{new_count_waker, AwokenCount}; #[cfg(loom)] const NUM_ITEMS: usize = 16; #[cfg(not(loom))] const NUM_ITEMS: usize = 64; fn new_handle() -> (EntryHandle, AwokenCount) { let (waker, count) = new_count_waker(); (EntryHandle::new(0, waker), count) } fn model<F: Fn() + Sen...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/time_alt/registration_queue/tests.rs
tokio/src/runtime/time_alt/registration_queue/tests.rs
use super::*; use futures::task::noop_waker; #[cfg(loom)] const NUM_ITEMS: usize = 16; #[cfg(not(loom))] const NUM_ITEMS: usize = 64; fn new_handle() -> EntryHandle { EntryHandle::new(0, noop_waker()) } fn model<F: Fn() + Send + Sync + 'static>(f: F) { #[cfg(loom)] loom::model(f); #[cfg(not(loom))...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/time_alt/wheel/level.rs
tokio/src/runtime/time_alt/wheel/level.rs
use super::{EntryHandle, EntryList}; use std::ptr::NonNull; use std::{array, fmt}; /// Wheel for a single level in the timer. This wheel contains 64 slots. pub(crate) struct Level { level: usize, /// Bit field tracking which slots currently contain entries. /// /// Using a bit field to track slots tha...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/runtime/time_alt/wheel/mod.rs
tokio/src/runtime/time_alt/wheel/mod.rs
mod level; pub(crate) use self::level::Expiration; use self::level::Level; use super::cancellation_queue::Sender; use super::{EntryHandle, EntryList, WakeQueue}; use std::array; /// Hashed timing wheel implementation. /// /// See [`Driver`] documentation for some implementation notes. /// /// [`Driver`]: crate::runt...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/time/timeout.rs
tokio/src/time/timeout.rs
//! Allows a future to execute for a maximum amount of time. //! //! See [`Timeout`] documentation for more details. //! //! [`Timeout`]: struct@Timeout use crate::{ task::coop, time::{error::Elapsed, sleep_until, Duration, Instant, Sleep}, util::trace, }; use pin_project_lite::pin_project; use std::futur...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/time/instant.rs
tokio/src/time/instant.rs
#![allow(clippy::trivially_copy_pass_by_ref)] use std::fmt; use std::ops; use std::time::Duration; /// A measurement of a monotonically nondecreasing clock. /// Opaque and useful only with `Duration`. /// /// Instants are always guaranteed to be no less than any previously measured /// instant when created, and are o...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/time/sleep.rs
tokio/src/time/sleep.rs
use crate::runtime::Timer; use crate::time::{error::Error, Duration, Instant}; use crate::util::trace; use pin_project_lite::pin_project; use std::future::Future; use std::panic::Location; use std::pin::Pin; use std::task::{self, ready, Poll}; /// Waits until `deadline` is reached. /// /// No work is performed while ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/time/clock.rs
tokio/src/time/clock.rs
#![cfg_attr(not(feature = "rt"), allow(dead_code))] //! Source of time abstraction. //! //! By default, `std::time::Instant::now()` is used. However, when the //! `test-util` feature flag is enabled, the values returned for `now()` are //! configurable. cfg_not_test_util! { use crate::time::{Instant}; #[deri...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/time/error.rs
tokio/src/time/error.rs
//! Time error types. use std::error; use std::fmt; /// Errors encountered by the timer implementation. /// /// Currently, there are two different errors that can occur: /// /// * `shutdown` occurs when a timer operation is attempted, but the timer /// instance has been dropped. In this case, the operation will nev...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/time/mod.rs
tokio/src/time/mod.rs
//! Utilities for tracking time. //! //! This module provides a number of types for executing code after a set period //! of time. //! //! * [`Sleep`] is a future that does no work and completes at a specific [`Instant`] //! in time. //! //! * [`Interval`] is a stream yielding a value at a fixed period. It is //! i...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/time/interval.rs
tokio/src/time/interval.rs
use crate::time::{sleep_until, Duration, Instant, Sleep}; use crate::util::trace; use std::future::{poll_fn, Future}; use std::panic::Location; use std::pin::Pin; use std::task::{ready, Context, Poll}; /// Creates new [`Interval`] that yields with interval of `period`. The first /// tick completes immediately. The de...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/lookup_host.rs
tokio/src/net/lookup_host.rs
cfg_net! { use crate::net::addr::{self, ToSocketAddrs}; use std::io; use std::net::SocketAddr; /// Performs a DNS resolution. /// /// The returned iterator may not actually yield any values depending on the /// outcome of any resolution performed. /// /// This API is not intended t...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/udp.rs
tokio/src/net/udp.rs
use crate::io::{Interest, PollEvented, ReadBuf, Ready}; use crate::net::{to_socket_addrs, ToSocketAddrs}; use crate::util::check_socket_for_blocking; use std::fmt; use std::io; use std::net::{self, Ipv4Addr, Ipv6Addr, SocketAddr}; use std::task::{ready, Context, Poll}; cfg_io_util! { use bytes::BufMut; } cfg_net...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
true
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/mod.rs
tokio/src/net/mod.rs
#![cfg(not(loom))] //! TCP/UDP/Unix bindings for `tokio`. //! //! This module contains the TCP/UDP/Unix networking types, similar to the standard //! library, which can be used to implement networking protocols. //! //! # Organization //! //! * [`TcpListener`] and [`TcpStream`] provide functionality for communication ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/addr.rs
tokio/src/net/addr.rs
use std::future; use std::io; use std::net::{IpAddr, Ipv4Addr, Ipv6Addr, SocketAddr, SocketAddrV4, SocketAddrV6}; /// Converts or resolves without blocking to one or more `SocketAddr` values. /// /// # DNS /// /// Implementations of `ToSocketAddrs` for string types require a DNS lookup. /// /// # Calling /// /// Curre...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/tcp/stream.rs
tokio/src/net/tcp/stream.rs
cfg_not_wasi! { use crate::net::{to_socket_addrs, ToSocketAddrs}; use std::future::poll_fn; use std::time::Duration; } use crate::io::{AsyncRead, AsyncWrite, Interest, PollEvented, ReadBuf, Ready}; use crate::net::tcp::split::{split, ReadHalf, WriteHalf}; use crate::net::tcp::split_owned::{split_owned, Own...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
true
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/tcp/split_owned.rs
tokio/src/net/tcp/split_owned.rs
//! `TcpStream` owned split support. //! //! A `TcpStream` can be split into an `OwnedReadHalf` and a `OwnedWriteHalf` //! with the `TcpStream::into_split` method. `OwnedReadHalf` implements //! `AsyncRead` while `OwnedWriteHalf` implements `AsyncWrite`. //! //! Compared to the generic split of `AsyncRead + AsyncWrite...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/tcp/listener.rs
tokio/src/net/tcp/listener.rs
use crate::io::{Interest, PollEvented}; use crate::net::tcp::TcpStream; use crate::util::check_socket_for_blocking; cfg_not_wasi! { use crate::net::{to_socket_addrs, ToSocketAddrs}; } use std::fmt; use std::io; use std::net::{self, SocketAddr}; use std::task::{ready, Context, Poll}; cfg_net! { /// A TCP sock...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/tcp/mod.rs
tokio/src/net/tcp/mod.rs
//! TCP utility types. pub(crate) mod listener; cfg_not_wasi! { pub(crate) mod socket; } mod split; pub use split::{ReadHalf, WriteHalf}; mod split_owned; pub use split_owned::{OwnedReadHalf, OwnedWriteHalf, ReuniteError}; pub(crate) mod stream; pub(crate) use stream::TcpStream;
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/tcp/socket.rs
tokio/src/net/tcp/socket.rs
use crate::net::{TcpListener, TcpStream}; use std::fmt; use std::io; use std::net::SocketAddr; #[cfg(unix)] use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; use std::time::Duration; cfg_windows! { use crate::os::windows::io::{AsRawSocket, FromRawSocket, IntoRawSocket, RawSocket, A...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
true
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/tcp/split.rs
tokio/src/net/tcp/split.rs
//! `TcpStream` split support. //! //! A `TcpStream` can be split into a `ReadHalf` and a //! `WriteHalf` with the `TcpStream::split` method. `ReadHalf` //! implements `AsyncRead` while `WriteHalf` implements `AsyncWrite`. //! //! Compared to the generic split of `AsyncRead + AsyncWrite`, this specialized //! split has...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/unix/stream.rs
tokio/src/net/unix/stream.rs
use crate::io::{AsyncRead, AsyncWrite, Interest, PollEvented, ReadBuf, Ready}; use crate::net::unix::split::{split, ReadHalf, WriteHalf}; use crate::net::unix::split_owned::{split_owned, OwnedReadHalf, OwnedWriteHalf}; use crate::net::unix::ucred::{self, UCred}; use crate::net::unix::SocketAddr; use crate::util::check_...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
true
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/unix/split_owned.rs
tokio/src/net/unix/split_owned.rs
//! `UnixStream` owned split support. //! //! A `UnixStream` can be split into an `OwnedReadHalf` and a `OwnedWriteHalf` //! with the `UnixStream::into_split` method. `OwnedReadHalf` implements //! `AsyncRead` while `OwnedWriteHalf` implements `AsyncWrite`. //! //! Compared to the generic split of `AsyncRead + AsyncWr...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/unix/listener.rs
tokio/src/net/unix/listener.rs
use crate::io::{Interest, PollEvented}; use crate::net::unix::{SocketAddr, UnixStream}; use crate::util::check_socket_for_blocking; use std::fmt; use std::io; #[cfg(target_os = "android")] use std::os::android::net::SocketAddrExt; #[cfg(target_os = "linux")] use std::os::linux::net::SocketAddrExt; #[cfg(any(target_os ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/unix/ucred.rs
tokio/src/net/unix/ucred.rs
use crate::net::unix; /// Credentials of a process. #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub struct UCred { /// PID (process ID) of the process. pid: Option<unix::pid_t>, /// UID (user ID) of the process. uid: unix::uid_t, /// GID (group ID) of the process. gid: unix::gid_t, } im...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/unix/mod.rs
tokio/src/net/unix/mod.rs
//! Unix specific network types. // This module does not currently provide any public API, but it was // unintentionally defined as a public module. Hide it from the documentation // instead of changing it to a private module to avoid breakage. #[doc(hidden)] pub mod datagram; pub(crate) mod listener; pub(crate) mod ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/unix/pipe.rs
tokio/src/net/unix/pipe.rs
//! Unix pipe types. use crate::io::interest::Interest; use crate::io::{AsyncRead, AsyncWrite, PollEvented, ReadBuf, Ready}; use mio::unix::pipe as mio_pipe; use std::fs::File; use std::io::{self, Read, Write}; use std::os::unix::fs::OpenOptionsExt; use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRa...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
true
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/unix/socketaddr.rs
tokio/src/net/unix/socketaddr.rs
use std::fmt; use std::path::Path; /// An address associated with a Tokio Unix socket. /// /// This type is a thin wrapper around [`std::os::unix::net::SocketAddr`]. You /// can convert to and from the standard library `SocketAddr` type using the /// [`From`] trait. #[derive(Clone)] pub struct SocketAddr(pub(super) st...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/unix/socket.rs
tokio/src/net/unix/socket.rs
use std::io; use std::path::Path; use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; use crate::net::{UnixDatagram, UnixListener, UnixStream}; cfg_net_unix! { /// A Unix socket that has not yet been converted to a [`UnixStream`], [`UnixDatagram`], or /// [`UnixListener`]. //...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/unix/split.rs
tokio/src/net/unix/split.rs
//! `UnixStream` split support. //! //! A `UnixStream` can be split into a read half and a write half with //! `UnixStream::split`. The read half implements `AsyncRead` while the write //! half implements `AsyncWrite`. //! //! Compared to the generic split of `AsyncRead + AsyncWrite`, this specialized //! split has no ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/unix/datagram/mod.rs
tokio/src/net/unix/datagram/mod.rs
//! Unix datagram types. pub(crate) mod socket;
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/unix/datagram/socket.rs
tokio/src/net/unix/datagram/socket.rs
use crate::io::{Interest, PollEvented, ReadBuf, Ready}; use crate::net::unix::SocketAddr; use crate::util::check_socket_for_blocking; use std::fmt; use std::io; use std::net::Shutdown; use std::os::unix::io::{AsFd, AsRawFd, BorrowedFd, FromRawFd, IntoRawFd, RawFd}; use std::os::unix::net; use std::path::Path; use std:...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
true
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/windows/mod.rs
tokio/src/net/windows/mod.rs
//! Windows specific network types. pub mod named_pipe;
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/net/windows/named_pipe.rs
tokio/src/net/windows/named_pipe.rs
//! Tokio support for [Windows named pipes]. //! //! [Windows named pipes]: https://docs.microsoft.com/en-us/windows/win32/ipc/named-pipes use std::ffi::c_void; use std::ffi::OsStr; use std::io::{self, Read, Write}; use std::pin::Pin; use std::ptr; use std::ptr::null_mut; use std::task::{Context, Poll}; use crate::io...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
true
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/signal/unix.rs
tokio/src/signal/unix.rs
//! Unix-specific types for signal handling. //! //! This module is only defined on Unix platforms and contains the primary //! `Signal` type for receiving notifications of signals. #![cfg(unix)] #![cfg_attr(docsrs, doc(cfg(all(unix, feature = "signal"))))] use crate::runtime::scheduler; use crate::runtime::signal::H...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/signal/windows.rs
tokio/src/signal/windows.rs
//! Windows-specific types for signal handling. //! //! This module is only defined on Windows and allows receiving "ctrl-c", //! "ctrl-break", "ctrl-logoff", "ctrl-shutdown", and "ctrl-close" //! notifications. These events are listened for via the `SetConsoleCtrlHandler` //! function which receives the corresponding ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/signal/registry.rs
tokio/src/signal/registry.rs
use crate::signal::os::{OsExtraData, OsStorage}; use crate::sync::watch; use std::ops; use std::sync::atomic::{AtomicBool, Ordering}; use std::sync::OnceLock; pub(crate) type EventId = usize; /// State for a specific event, whether a notification is pending delivery, /// and what listeners are registered. #[derive(D...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/signal/mod.rs
tokio/src/signal/mod.rs
//! Asynchronous signal handling for Tokio. //! //! Note that signal handling is in general a very tricky topic and should be //! used with great care. This crate attempts to implement 'best practice' for //! signal handling, but it should be evaluated for your own applications' needs //! to see if it's suitable. //! /...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/signal/ctrl_c.rs
tokio/src/signal/ctrl_c.rs
#[cfg(unix)] use super::unix::{self as os_impl}; #[cfg(windows)] use super::windows::{self as os_impl}; use std::io; /// Completes when a "ctrl-c" notification is sent to the process. /// /// While signals are handled very differently between Unix and Windows, both /// platforms support receiving a signal on "ctrl-c"...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/signal/reusable_box.rs
tokio/src/signal/reusable_box.rs
use std::alloc::Layout; use std::future::Future; use std::panic::AssertUnwindSafe; use std::pin::Pin; use std::ptr::{self, NonNull}; use std::task::{Context, Poll}; use std::{fmt, panic}; /// A reusable `Pin<Box<dyn Future<Output = T> + Send>>`. /// /// This type lets you replace the future stored in the box without /...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/signal/windows/stub.rs
tokio/src/signal/windows/stub.rs
//! Stub implementations for the platform API so that rustdoc can build linkable //! documentation on non-windows platforms. use crate::signal::RxFuture; use std::io; pub(super) fn ctrl_break() -> io::Result<RxFuture> { panic!() } pub(super) fn ctrl_close() -> io::Result<RxFuture> { panic!() } pub(super) fn...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/signal/windows/sys.rs
tokio/src/signal/windows/sys.rs
use std::io; use std::sync::Once; use crate::signal::registry::{globals, EventId, EventInfo, Storage}; use crate::signal::RxFuture; use windows_sys::core::BOOL; use windows_sys::Win32::System::Console as console; pub(super) fn ctrl_break() -> io::Result<RxFuture> { new(console::CTRL_BREAK_EVENT) } pub(super) fn...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/task/blocking.rs
tokio/src/task/blocking.rs
use crate::task::JoinHandle; cfg_rt_multi_thread! { /// Runs the provided blocking function on the current thread without /// blocking the executor. /// /// In general, issuing a blocking call or performing a lot of compute in a /// future without yielding is problematic, as it may prevent the exec...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
false
tokio-rs/tokio
https://github.com/tokio-rs/tokio/blob/41d1877689f8669902b003a6affce60bdfeb3025/tokio/src/task/local.rs
tokio/src/task/local.rs
//! Runs `!Send` futures on the current thread. use crate::loom::cell::UnsafeCell; use crate::loom::sync::{Arc, Mutex}; use crate::runtime; use crate::runtime::task::{ self, JoinHandle, LocalOwnedTasks, SpawnLocation, Task, TaskHarnessScheduleHooks, }; use crate::runtime::{context, ThreadId, BOX_FUTURE_THRESHOLD}; ...
rust
MIT
41d1877689f8669902b003a6affce60bdfeb3025
2026-01-04T15:33:40.250594Z
true