tokio-rs/tokio
70.6
Strong · 14 November 2026
115.2k
lines of production code
Rust
primary language
5
measurements over time
What this system is
Features
Add comprehensive benchmark suite for I/O, synchronization, and runtime internals
This change introduces a new set of benchmarks located in the \benches/\ directory, providing performance regression tests and measurements for key Tokio subsystems. The suite includes benchmarks for asynchronous I/O operations (\copy\, \fs\), network socket acceptance patterns (\net\_accept\), and task scheduling mechanics including remote spawn contention (\remote\_spawn\), local/remote spawning on current-thread and multi-threaded runtimes (\rt\_current\_thread\, \rt\_multi\_threaded\, \spawn\), and \spawn\_blocking\ concurrency. It also covers synchronization primitives such as \mpsc\ channels (including \recv\_many\), \broadcast\ channels, \Notify\, \RwLock\, \Semaphore\, and \oneshot\ channels, as well as OS signal propagation (\signal\). All benchmarks utilize the Criterion framework to measure performance characteristics like throughput and contention under various concurrency levels.
benches · high confidence
Add integration test crate with conditional documentation
A new integration test crate has been added at tests-integration/src/lib.rs. It conditionally includes the project README as documentation when the 'full' feature flag is enabled, ensuring that users building with this feature see the relevant documentation within the crate.
tests-integration/src · high confidence
Add io\_uring operation infrastructure
Introduces the core \Op\ type and supporting traits (\Completable\, \Cancellable\) in \tokio/src/runtime/driver/op.rs\ to manage the lifecycle of io\_uring operations. This infrastructure handles operation submission, polling, completion, and cancellation, serving as the foundation for subsequent io\_uring-based file system and I/O operations.
tokio/src/runtime/driver · high confidence
Add io\_uring support for file opening operations
This change introduces a new \UringOpenOptions\ struct and a mock implementation for \std::fs::OpenOptions\ within the \tokio::fs\ module. The \UringOpenOptions\ struct captures file opening flags (read, write, append, create, truncate, create\_new) and platform-specific attributes (mode, custom flags) to facilitate io\_uring-based file operations. The mock allows for testing without actual file system interactions, ensuring that the new io\_uring path can be validated independently of the standard library's behavior.
_tokio/src/fs/open\options · high confidence
Add io\_uring-based I/O driver infrastructure
The runtime now includes a new io\_uring backend for I/O operations. This change introduces the core driver components (\signal.rs\ and \uring.rs\) that handle io\_uring initialization, operation submission, completion dispatch, and signal handling. Users on compatible Linux kernels will benefit from lower-latency I/O when io\_uring is available, while the runtime automatically falls back to existing mechanisms if io\_uring is unsupported or fails to initialize.
tokio/src/runtime/io/driver · high confidence
Add new examples for chat, graceful shutdown, and Linux FD table pre-warming
The examples directory now includes a chat server demonstrating shared state and message broadcasting, a graceful shutdown example using CancellationToken and TaskTracker, and a Linux-specific pre-warming example for the file descriptor table to avoid latency spikes. Existing examples such as echo-tcp, connect-tcp, and proxy have been updated to use current Tokio APIs and patterns.
examples · high confidence
Added POSIX AIO support for FreeBSD
Users on FreeBSD can now perform asynchronous I/O operations using the POSIX AIO standard. This change introduces the \Aio\ struct and the \AioSource\ trait in \tokio/src/io/bsd/poll\_aio.rs\, allowing applications to register AIO event sources with Tokio's reactor. The implementation supports both standard AIO (\aio\_read\, \aio\_write\, etc.) and list I/O (\lio\_listio\), leveraging kqueue for event notification. The API includes methods for polling readiness (\poll\_ready\), clearing readiness (\clear\_ready\), and managing the lifecycle of the AIO source, ensuring compatibility with Tokio's existing I/O safety and registration mechanisms.
tokio/src/io/bsd · high confidence
Added UdpFramed for UDP socket framing
The \tokio-util\ crate now exposes \UdpFramed\, a unified \Stream\ and \Sink\ interface for \UdpSocket\ that uses \Encoder\ and \Decoder\ traits to handle message framing. This allows users to batch raw UDP datagrams into meaningful frames, supporting distinct incoming and outgoing frame types, and enables splitting the framed socket into separate stream and sink components for easier layering.
tokio-util/src/udp · high confidence
Adds alternative time driver for improved multicore scalability
This change introduces a new alternative timer implementation (\time\_alt\) within the runtime scheduler utilities, gated behind the \tokio\_unstable\ feature flag. The new module provides functions to manage timer registration, expiration, and cancellation using a wheel-based structure, aiming to enhance scalability on multicore systems. Users enabling this unstable feature will have access to this alternative time handling logic, which is integrated into the multi-threaded runtime's time driver infrastructure.
tokio/src/runtime/scheduler/util · high confidence
Async file system module introduced
The \tokio::fs\ module is now available, providing asynchronous wrappers for standard library file operations. This includes high-level convenience functions like \read\, \write\, \copy\, and \canonicalize\, as well as a \File\ type that implements \AsyncRead\ and \AsyncWrite\ for streaming I/O. Directory management is supported via \create\_dir\, \create\_dir\_all\, \remove\_dir\, \remove\_dir\_all\, and a \DirBuilder\ for recursive creation with optional Unix mode settings. The module also exposes metadata queries, hard links, and symbolic link resolution. On Linux, io\_uring support is included for specific operations like reading files when the runtime is configured accordingly, while other operations fall back to the blocking thread pool.
tokio/src/fs · high confidence
CancellationToken now supports scoped cancellation via DropGuard and DropGuardRef
The \CancellationToken\ implementation has been rewritten to include a tree-based structure for managing parent-child relationships and a new mechanism for scoped cancellation. Users can now create a \DropGuard\ (owned) or \DropGuardRef\ (borrowed) which automatically cancels the token when the guard goes out of scope. These guards also provide a \token()\ method to access the underlying token and a \disarm()\ method to prevent automatic cancellation if needed. This change simplifies resource management by ensuring tokens are cancelled when specific scopes end, reducing the need for manual cancellation calls.
_tokio-util/src/sync/cancellation\token · high confidence
Initial implementation of asynchronous process management
Adds the \tokio::process\ module, providing asynchronous support for spawning and managing child processes. This includes the \Command\ builder for configuring and launching processes, the \Child\ type for interacting with running processes (including async waiting and killing), and \ChildStdin\, \ChildStdout\, and \ChildStderr\ for handling standard I/O streams. The implementation uses platform-specific mechanisms (such as \RegisterWaitForSingleObject\ on Windows and blocking thread pools for I/O on Unix) to integrate process lifecycle events with the Tokio runtime.
tokio/src/process · high confidence
Initial io\_uring backend for file system operations
This change introduces the internal io\_uring implementation for Tokio's file system operations, adding support for opening files, reading, writing, renaming, and retrieving metadata (via statx). It also includes infrastructure for handling cancellation and retrying interrupted operations, enabling faster, asynchronous I/O on Linux systems that support io\_uring.
tokio/src/io/uring · high confidence
Initial repository scaffolding and project governance
The repository is initialized with foundational project files, including a README detailing the Tokio runtime, a MIT LICENSE, and a SECURITY.md outlining private vulnerability reporting via [e-mail redacted]. Governance is established through a CODE\_OF\_CONDUCT.md referencing the Rust standard, a CONTRIBUTING.md defining LTS guarantees and MSRV policies, and a Cross.toml for cross-compilation configuration. CI and quality gates are configured via netlify.toml for documentation previews, deny.toml for license and dependency auditing, and spellcheck configuration files.
(repo-wide) · high confidence
Internal task tracing infrastructure for runtime diagnostics
The \tokio/src/runtime/task/trace\ module has been introduced to provide the internal machinery for capturing and formatting task execution traces (task dumps). This change adds the \Context\, \Trace\, and \Tree\ structures, along with symbol resolution and tree formatting logic, which are required to support the new task dump capabilities in the multi-thread runtime. This enables users to obtain detailed backtrace information for tasks during debugging or diagnostics.
tokio/src/runtime/task/trace · high confidence
Introduce H2-based Log Histogram for runtime metrics
Added a new H2-based log histogram implementation (\LogHistogram\) to the runtime metrics subsystem, offering better performance than the previous HdrHistogram-based approach. This new histogram allows users to configure precision (error bounds) and value ranges via a builder, with sensible defaults (100ns min, 60s max, 25% max error) that use 237 buckets. It modifies how duration metrics are bucketed, grouping very short durations into a single initial bucket and extending the final bucket to infinity, which changes the granularity and distribution of reported runtime metrics.
tokio/src/runtime/metrics/histogram · high confidence
Introduce LocalRuntime for non-Send task execution
Adds a new \LocalRuntime\ type that allows spawning and driving tasks that are not \Send\ or \Sync\ without requiring a \LocalSet\. This runtime is bound to a single thread and provides a \spawn\_local\ method for non-thread-safe futures, while still supporting \spawn\_blocking\ for offloading work to a dedicated thread pool.
_tokio/src/runtime/local\runtime · high confidence
Introduce Windows named pipe support
Adds \NamedPipeServer\ and \NamedPipeClient\ types to \tokio::net::windows\, enabling asynchronous communication via Windows named pipes. The new API includes \ServerOptions\ for configuring pipe instances and modes, along with async methods like \connect()\ for servers and read/write capabilities for both client and server endpoints.
tokio/src/net/windows · high confidence
Introduce internal timing wheel implementation for DelayQueue
The \tokio-util\ crate now includes a new internal hashed timing wheel implementation (\tokio-util/src/time/wheel\) that backs the \DelayQueue\ type. This change introduces the \Wheel\, \Level\, and \Stack\ modules, which manage timer entries across six levels of 64-slot arrays to track expirations up to two years into the future with millisecond precision. The implementation uses a bit field to efficiently track occupied slots and provides methods for inserting, removing, and polling timer entries, forming the core data structure for the \DelayQueue\ functionality.
tokio-util/src/time/wheel · high confidence
Introduce tokio-stream crate with core stream utilities and adapters
The \tokio-stream\ crate is introduced to provide a dedicated home for stream-related utilities, separating them from the main \tokio\ crate. This location adds foundational stream constructors (\empty\, \iter\, \once\, \pending\), a comprehensive \StreamExt\ trait with combinators (e.g., \map\, \filter\, \merge\, \timeout\), and a \StreamMap\ for managing multiple concurrent streams. It also includes wrapper types that adapt Tokio's internal synchronization primitives (like \mpsc\ channels, \broadcast\/\watch\ channels, and \JoinSet\) into \Stream\ implementations, along with a \StreamNotifyClose\ wrapper to detect when underlying streams terminate.
tokio-stream/src · high confidence
Introduce tokio-stream with comprehensive StreamExt combinators
The \tokio-stream\ crate is introduced, providing a \StreamExt\ trait and a suite of stream adapters including \all\, \any\, \chain\, \chunks\_timeout\, \collect\, \filter\, \filter\_map\, \fold\, \fuse\, \map\, \map\_while\, \merge\, \next\, \peekable\, \skip\, \skip\_while\, \take\, \take\_while\, \then\, \throttle\, \timeout\, and \timeout\_repeating\. These combinators enable users to transform, combine, and control asynchronous streams with features such as cancel-safe iteration (\next\, \try\_next\), size-hint-aware buffering (\chunks\_timeout\), and deadline-based error handling (\timeout\, \timeout\_repeating\).
_tokio-stream/src/stream\ext · high confidence
Introduce tokio-test crate for async testing utilities
Adds the \tokio-test\ crate, providing a suite of utilities for testing asynchronous Rust code. This includes a \Mock\ I/O type in \tokio-test::io\ that implements \AsyncRead\ and \AsyncWrite\ to simulate network behavior via a predefined script, a \StreamMock\ in \tokio-test::stream\_mock\ for mocking stream behavior with configurable waits and items, and a \Spawn\ harness in \tokio-test::task\ to poll futures and streams without manual pinning or context setup. The crate also exports assertion macros (\assert\_ready\, \assert\_pending\, etc.) in \tokio-test::macros\ and a \block\_on\ helper in \tokio-test::lib\ to run async code in tests.
tokio-test/src · high confidence
Introduce tokio-util codec module with framing abstractions
The \tokio-util/src/codec\ module is introduced, providing a complete set of framing utilities for asynchronous I/O. This includes the core \Decoder\ and \Encoder\ traits, the \Framed\, \FramedRead\, and \FramedWrite\ adapters that layer framing over \AsyncRead\ and \AsyncWrite\ streams, and several concrete codec implementations: \LengthDelimitedCodec\ for protocols using length-prefix framing, \LinesCodec\ for newline-delimited text, \BytesCodec\ for raw byte shipping, and \AnyDelimiterCodec\ for splitting data by arbitrary delimiter characters. The module also exposes buffer management features such as \with\_capacity\ constructors and mutable buffer accessors on the framed types.
tokio-util/src/codec · high confidence
Introduce unstable runtime metrics API
Adds a new \tokio::runtime::metrics\ module providing \RuntimeMetrics\ to observe runtime performance. The API exposes stable counters for worker park counts, alive tasks, and global queue depth, while offering unstable metrics for worker busy duration, poll counts, steal operations, and schedule latency histograms when the \tokio\_unstable\ feature is enabled.
tokio/src/runtime/metrics · high confidence
Introduction of AtomicWaker for safe task notification
A new \AtomicWaker\ synchronization primitive has been added to the \tokio::sync::task\ module to coordinate concurrent task waking. This internal component allows producers to wake consumers safely even when the consumer is in the process of migrating to a new logical task, ensuring that wake signals are not lost during race conditions between registration and execution.
tokio/src/sync/task · high confidence
Introduction of UnixDatagram for Unix domain datagram sockets
This change introduces the \UnixDatagram\ type, enabling asynchronous communication via Unix domain datagram sockets. Users can now create named sockets bound to filesystem paths or unnamed paired sockets for inter-process communication. The implementation supports standard asynchronous operations such as \send\, \recv\, \send\_to\, and \recv\_from\, along with readiness polling via \ready()\ and non-blocking attempts via \try\_send\/\try\_recv\. The socket is designed to be shared across tasks using \Arc\ without requiring a \Mutex\, as all methods take \&self\.
tokio/src/net/unix/datagram · high confidence
Introduction of async DNS resolution via \`lookup\_host\` and \`ToSocketAddrs\` trait
Users can now resolve hostnames to socket addresses asynchronously using the new \tokio::net::lookup\_host\ function and the \ToSocketAddrs\ trait. This replaces the need for synchronous DNS lookups in networking code, allowing \UdpSocket::bind\ and other network methods to accept string-based addresses (like "localhost:3000") and resolve them in the background without blocking the executor.
tokio/src/net · high confidence
Introduction of asynchronous synchronization primitives
The \tokio::sync\ module now provides a comprehensive set of asynchronous synchronization primitives, including \Mutex\, \RwLock\, \Semaphore\, \Notify\, \Barrier\, \OnceCell\, \oneshot\, \mpsc\, and \broadcast\ channels. These types enable safe communication and coordination between asynchronous tasks without blocking threads, supporting patterns such as message passing, resource limiting, and task rendezvous.
tokio/src/sync · high confidence
Introduction of core asynchronous I/O traits and utilities
This change introduces the foundational asynchronous I/O traits and types for the \tokio::io\ module. It defines \AsyncRead\ and \AsyncWrite\ as the primary interfaces for non-blocking reading and writing, replacing synchronous blocking calls with futures that integrate with the Tokio scheduler. It also adds \AsyncBufRead\ for buffered reading operations, \AsyncSeek\ for asynchronous file positioning, and \AsyncFd\ for associating raw file descriptors with the reactor. Additionally, it provides utility types such as \Join\ to combine separate reader and writer handles, \Interest\ to specify readiness events, and \Blocking\ to wrap synchronous I/O operations on the blocking thread pool.
tokio/src/io · high confidence
Introduction of dedicated TCP networking types
This change introduces the core TCP types for the Tokio runtime, including \TcpListener\ for accepting incoming connections, \TcpStream\ for managing active connections, and \TcpSocket\ for configuring socket options before binding or connecting. It also adds support for splitting \TcpStream\ into separate read and write halves (both borrowed and owned variants), enabling concurrent independent access to the stream's I/O channels.
tokio/src/net/tcp · high confidence
Introduction of internal utility modules in tokio::util
The \tokio/src/util\ directory now contains a comprehensive set of internal helper modules that support the runtime's core functionality. This includes \linked\_list\ and \sharded\_list\ for intrusive data structures used in synchronization and task management, \atomic\_cell\ and \rc\_cell\ for safe interior mutability, and \wake\_list\ for efficient task notification. Additionally, new modules provide \CachePadded\ for false-sharing prevention, \metric\_atomics\ for runtime metrics, \memchr\ for optimized byte searching, and \trace\ for structured task instrumentation. These utilities collectively enhance the performance, safety, and observability of Tokio's internal components.
tokio/src/util · high confidence
Introduction of the \`tokio::time\` module with time-sleeping and interval primitives
This change introduces the \tokio::time\ module, providing core time-management utilities for asynchronous applications. Users can now use \sleep\ and \sleep\_until\ to pause execution for a duration or until a specific instant, and \interval\/\interval\_at\ to repeatedly execute tasks on a fixed schedule with configurable missed-tick behavior. The module also includes \timeout\ and \timeout\_at\ to limit the execution time of futures, returning an \Elapsed\ error if the deadline passes. Additionally, it provides a test-friendly \Instant\ type that supports pausing and advancing time via the \test-util\ feature, allowing for deterministic testing of time-dependent logic without relying on real-world clock speed.
tokio/src/time · high confidence
Introduction of the current-thread scheduler implementation
Adds the \CurrentThread\ scheduler, which executes tasks on the current thread. This implementation introduces support for runtime names, user-supplied task hooks (spawn, terminate, and unstable poll callbacks), schedule latency tracking, and specific metrics for worker threads and scheduler operations.
_tokio/src/runtime/scheduler/current\thread · high confidence
New I/O adapters and utilities in tokio-util
The \tokio\_util::io\ module now exposes several new types and functions to bridge async and synchronous I/O, convert between streams and readers, and inspect data flows. \StreamReader\ and \ReaderStream\ allow converting a \Stream\ of byte chunks into an \AsyncRead\ and vice versa, with \StreamReader\ also implementing \AsyncBufRead\ for line-by-line reading. \SyncIoBridge\ enables using \AsyncRead\/\AsyncWrite\ types synchronously (e.g., in \spawn\_blocking\), while \InspectReader\ and \InspectWriter\ provide adapters to observe data as it is read or written. \SinkWriter\ converts a \Sink\<&\[u8\]\>\ into an \AsyncWrite\, and \CopyToBytes\ wraps a \Sink\<Bytes\>\ to accept \&\[u8\]\. Additionally, \write\_all\_vectored\ writes multiple buffers efficiently, \read\_exact\_arc\ reads into an \Arc\<\[u8\]\>\, and \read\_buf\ reads into any \BufMut\. A new \simplex\ module provides a unidirectional async byte channel with \Sender\ and \Receiver\ halves.
tokio-util/src/io · high confidence
New Listener trait unifies TcpListener and UnixListener
A new \Listener\ trait has been added to \tokio-util/src/net\, allowing \TcpListener\ and \UnixListener\ to be treated uniformly. This enables generic code to handle both TCP and Unix domain socket listeners, and includes implementations for the \Either\ type to support switching between listener types.
tokio-util/src/net · high confidence
New Unix socket types: UnixSocket, UnixListener, and Unix pipe support
This change introduces the \UnixSocket\ type, allowing users to configure Unix socket options (such as binding and listen backlog) before converting them into \UnixStream\, \UnixDatagram\, or \UnixListener\. It also adds \UnixListener\ for accepting incoming Unix socket connections and provides \Sender\ and \Receiver\ types for anonymous and named Unix pipes, including \OpenOptions\ for configuring FIFO access on Linux/Android. Additionally, the \UCred\ type is updated to expose the process ID (\pid\) across a wider range of platforms, and \SocketAddr\ gains methods to inspect abstract namespace names.
tokio/src/net/unix · high confidence
New alternative timer implementation for improved multicore scalability
Tokio introduces a new alternative timer implementation (\time\_alt\) designed to provide better scalability on multicore systems. This change adds a new internal timer architecture featuring a hashed timing wheel, separate registration and cancellation queues, and a dedicated wake queue to manage timer entries. The implementation includes specific handling for timer lifecycle states, race conditions between cancellation and insertion, and direct expiration during runtime shutdown, offering a new backend option for time-based operations.
_tokio/src/runtime/time\alt · high confidence
New cooperative scheduling utilities: consume\_budget and unconstrained
Tokio now exposes a public \task::coop\ module containing \consume\_budget\ and \unconstrained\ to help manage task scheduling. \consume\_budget\ provides an async yield point that allows long-running computations to voluntarily return control to the runtime when the cooperative budget is exhausted, preventing starvation of other tasks. \unconstrained\ allows users to wrap a future to disable cooperative scheduling limits for that specific task, giving full control over its execution flow without forced yields.
tokio/src/task/coop · high confidence
New portable ctrl\_c() API and expanded Windows signal handling
Tokio now provides a cross-platform \signal::ctrl\_c()\ function that returns a future completing on the first Ctrl+C notification, abstracting away platform-specific signal handling differences. On Windows, the signal module has been expanded to expose dedicated listeners for Ctrl-C, Ctrl-Break, Ctrl-Logoff, Ctrl-Shutdown, and Ctrl-Close events via new \CtrlC\, \CtrlBreak\, and related types, allowing applications to handle these console control events asynchronously. The implementation introduces a generic \Registry\ for managing signal event listeners and a \ReusableBoxFuture\ for efficient future storage, ensuring that signal notifications are coalesced and delivered reliably across both Unix and Windows platforms.
tokio/src/signal · high confidence
New runtime metrics and task dump capabilities for multi-threaded scheduler
The multi-threaded scheduler handle now exposes a comprehensive set of runtime metrics, including the number of alive tasks, injection queue depth, worker count, and blocking thread statistics, allowing users to monitor scheduler performance and resource usage. Additionally, a new \dump\ method has been added to the handle, enabling users to request a synchronous snapshot of the current runtime state (task traces) for debugging purposes, with proper synchronization to prevent concurrent dump requests.
_tokio/src/runtime/scheduler/multi\thread/handle · high confidence
New stream wrappers for Tokio sync, time, IO, and task primitives
The \tokio-stream\ wrappers module now provides \Stream\ implementations for several Tokio primitives, allowing them to be used directly in async streams. This includes wrappers for synchronization primitives (\BroadcastStream\, \WatchStream\, \ReceiverStream\, \UnboundedReceiverStream\), time (\IntervalStream\), IO (\LinesStream\, \SplitStream\, \ReadDirStream\), networking (\TcpListenerStream\, \UnixListenerStream\), signals (\SignalStream\, \CtrlCStream\, \CtrlBreakStream\), and tasks (\JoinSetStream\). These wrappers enable ergonomic integration of Tokio's internal types with the \futures\ ecosystem.
tokio-stream/src/wrappers · high confidence
New synchronization primitives in tokio-util
The \tokio\_util::sync\ module now provides \CancellationToken\ for signaling cancellation across tasks, \PollSender\ to wrap \mpsc::Sender\ with a pollable \Sink\ interface, and \PollSemaphore\ to wrap \Semaphore\ with a pollable acquisition interface. These additions also include supporting utilities like \ReusableBoxFuture\ for efficient future reuse and \DropGuard\ types for cancellation safety.
tokio-util/src/sync · high confidence
New task management APIs: JoinSet, Builder, and block\_in\_place
The \tokio::task\ module introduces \JoinSet\ for managing and awaiting sets of concurrent tasks, \Builder\ for configuring task properties like names before spawning, and \block\_in\_place\ to allow synchronous blocking code to run without starving the executor in multi-threaded runtimes. These additions provide structured ways to handle task lifecycles, configuration, and synchronous workloads alongside the existing \spawn\ and \spawn\_blocking\ functions.
tokio/src/task · high confidence
New task management internals: AbortHandle, JoinHandle, and task IDs
The \tokio/src/runtime/task\ module has been restructured to introduce dedicated types for task lifecycle management. Users can now use \AbortHandle\ to remotely cancel a spawned task without awaiting its completion, and \JoinHandle\ to await the task's result or detach it. Both handles expose an \id()\ method to retrieve a unique \task::Id\ for the task, which can also be obtained from within the task via \task::id()\ or \task::try\_id()\. The \JoinError\ type now includes the task ID in its display and debug output, and provides \is\_cancelled()\ and \is\_panic()\ methods to distinguish between cancellation and panic outcomes. These changes are part of the internal task harness and state management, supporting features like \JoinSet\ and task metrics.
tokio/src/runtime/task · high confidence
New task management utilities: JoinMap, JoinQueue, AbortOnDrop, and LocalPoolHandle
The \tokio\_util::task\ module now exposes several new types for managing asynchronous tasks. \JoinMap\ allows spawning tasks associated with hash map keys, enabling cancellation and retrieval of results by key. \JoinQueue\ provides a FIFO-ordered collection for awaiting task completions in the order they were spawned. \AbortOnDrop\ and \AbortOnDropHandle\ are wrappers that automatically abort their associated tasks when dropped, ensuring cleanup. Additionally, \LocalPoolHandle\ offers a cloneable handle to a pool of threads for spawning \!Send\ tasks, and \TaskTracker\ provides a way to wait for tasks to exit without retaining their return values in memory.
tokio-util/src/task · high confidence
New tokio::io utility traits and buffered types
This release introduces a comprehensive set of extension traits and buffered I/O types to simplify asynchronous programming. The new \AsyncReadExt\, \AsyncWriteExt\, \AsyncBufReadExt\, and \AsyncSeekExt\ traits provide convenient methods for reading and writing data, including \read\_until\, \read\_line\, \read\_exact\, \write\_vectored\, and \rewind\. Additionally, \BufReader\, \BufWriter\, and \BufStream\ are added to buffer input and output, improving performance for small, repeated I/O operations. Utilities like \Chain\ for linking readers and \copy\/\copy\_bidirectional\ for transferring data between streams are also included.
tokio/src/io/util · high confidence
Tokio adds owned RwLock guards and downgrade mapping
The \tokio::sync::RwLock\ API now supports ownership transfer via new \OwnedRwLockReadGuard\ and \OwnedRwLockWriteGuard\ types, created by \read\_owned\ and \write\_owned\ methods, allowing guards to be moved across tasks or stored in \Arc\. Both owned and standard guards now support mapping operations (\map\ and \try\_map\) to access sub-components of the locked data, and write guards provide \downgrade\_map\ to atomically transition from exclusive write access to shared read access on a mapped component.
tokio/src/sync/rwlock · high confidence
Tokio macros now support configurable runtime flavors and unhandled panic behaviors
The \\#\[tokio::main\]\ and \\#\[tokio::test\]\ macros now accept configuration attributes to control runtime behavior. Users can specify the \flavor\ as \current\_thread\, \multi\_thread\, or \local\ to select the scheduler type, and can configure \worker\_threads\ for multi-threaded runtimes. Additionally, the \unhandled\_panic\ attribute allows users to define whether a panic in the runtime should be ignored or trigger a shutdown, providing finer control over error handling in async applications.
tokio-macros/src · high confidence
Tokio-util initial release with core utilities
This release introduces the tokio-util crate, providing a collection of utilities for working with Tokio. Key additions include a compatibility layer (via the \compat\ feature) to bridge \tokio::io\ and \futures-io\ traits, a \TokioContext\ wrapper (via the \rt\ feature) to run Tokio-dependent futures on non-Tokio runtimes, and an \Either\ type to handle heterogeneous async types. The crate also exposes \FutureExt\ adapters for timeouts and cancellation tokens, re-exports the \bytes\ crate, and includes conditional compilation macros to manage feature-gated modules like codec, net, io, and time.
tokio-util/src · high confidence
Windows signal handling now supports Ctrl+Logoff and Ctrl+Shutdown events
The Windows signal module has been expanded to handle additional console control events: Ctrl+Logoff and Ctrl+Shutdown. These new signals are now registered via \SetConsoleCtrlHandler\ and can be listened to using \tokio::signal::ctrl\_logoff()\ and \tokio::signal::ctrl\_shutdown()\. The implementation ensures that handlers for these terminating events block the thread to prevent immediate process termination, allowing async tasks to perform cleanup. Stub implementations are also provided for non-Windows platforms to maintain documentation compatibility.
tokio/src/signal/windows · high confidence
Removals
Removal of example binary programs
The example binary programs \echo.rs\ and \sink.rs\ have been removed from the distribution. These files previously demonstrated how to use the \futures\ and \futures\_mio\ crates to build simple TCP servers, including handling incoming connections and performing I/O operations.
src/bin · high confidence
Removal of legacy tokio-core I/O abstractions
The \src\ directory has removed the core \tokio-core\ implementation files, including \event\_loop.rs\, \readiness\_stream.rs\, \buf\_reader.rs\, \buf\_writer.rs\, and \tcp.rs\. This eliminates the legacy \Loop\/\LoopHandle\ event loop model, the \ReadinessStream\ readiness abstraction, and the custom buffered I/O types (\BufReader\, \BufWriter\) that were previously re-exported from the crate root. Users relying on these specific types and the associated futures-based I/O patterns in this location will no longer have access to them.
src · high confidence
Architecture
Introduction of internal macro infrastructure and support modules
The \tokio/src/macros\ directory now contains the foundational implementation files for the library's async macros. This includes \select.rs\, \join.rs\, and \try\_join.rs\ which define the core concurrency primitives, along with \pin.rs\ for stack pinning, \cfg.rs\ for feature-gated code generation, and \support.rs\ for shared macro helpers like \maybe\_done\ and \poll\_fn\. This change establishes the internal structure required for these macros to function, moving their implementation into dedicated modules.
tokio/src/macros · high confidence
Multi-thread runtime scheduler refactored into modular components
The multi-thread runtime scheduler has been restructured into distinct, modular source files (counters, handle, idle, overflow, park, queue, stats, trace, and worker) to improve code organization and maintainability. This change introduces internal atomic counters for debugging and performance analysis (e.g., local notifies, unparks, LIFO schedules), refines the worker idle/search coordination logic, and separates parking/unparking mechanisms from the core scheduler loop. It also adds support for task tracing/dumping via dedicated trace modules and stabilizes internal metrics collection through a dedicated stats module, providing better observability into scheduler behavior without changing the public API.
_tokio/src/runtime/scheduler/multi\thread · high confidence
Refactor runtime context internals into modular files
The internal implementation of the runtime context in \tokio/src/runtime/context\ has been reorganized from a single module into separate files (\blocking.rs\, \current.rs\, \runtime.rs\, \runtime\_mt.rs\, \scoped.rs\). This change splits the responsibilities for managing thread-local state, such as blocking region guards, current scheduler handles, and runtime entry/exit logic, into distinct components. This refactoring improves code maintainability and separation of concerns within the runtime's internal context management without altering the public API or external behavior.
tokio/src/runtime/context · high confidence
Reorganized I/O driver internals into a dedicated runtime module
The I/O driver implementation has been restructured into a new \tokio/src/runtime/io\ module, splitting the previous monolithic driver code into focused components: \driver.rs\ (the main event loop and handle), \registration.rs\ (resource association and polling), \registration\_set.rs\ (tracking and lifecycle management), \scheduled\_io.rs\ (per-resource state and readiness), and \metrics.rs\ (mock and real metrics). This change improves code organization and maintainability without altering the public API or runtime behavior.
tokio/src/runtime/io · high confidence
Runtime scheduler implementation restructured into modular components
The runtime scheduler logic has been reorganized into distinct, dedicated modules within \tokio/src/runtime/scheduler\. This change introduces separate files for core scheduling behaviors: \block\_in\_place.rs\ handles blocking operations, \defer.rs\ manages deferred waker execution, and \inject.rs\ implements the multi-producer multi-consumer queue for injecting tasks into the scheduler. The \mod.rs\ file now acts as a central dispatcher, using an enum-based \Handle\ to route operations to either the \CurrentThread\ or \MultiThread\ scheduler implementations based on the active runtime feature. This modularization isolates specific runtime mechanics, making the scheduler's internal structure more maintainable and explicit.
tokio/src/runtime/scheduler · high confidence
Timer wheel implementation moved into runtime module
The internal hashed timing wheel implementation has been relocated from its previous location into the \runtime\ module (\tokio/src/runtime/time/wheel\). This change reorganizes the source tree, moving the \Level\ and \Wheel\ structs, along with their associated logic for managing timer slots and expirations, into the new \runtime/time/wheel\ directory structure. Users relying on internal paths or direct imports of these private implementation details will need to update their references, although the public API of the \tokio\ runtime remains unaffected.
tokio/src/runtime/time/wheel · high confidence
Tokio runtime architecture refactored into modular components
The runtime implementation has been reorganized into distinct modules to improve maintainability and separation of concerns. The \Builder\ now exposes a comprehensive \Config\ struct for internal settings, while \context.rs\ centralizes thread-local state management for the scheduler, runtime handle, and task IDs. Driver initialization is now handled by a unified \driver.rs\ module that abstracts the I/O, signal, and time driver stack. Additionally, new modules introduce \dump.rs\ for task state snapshots (backtraces and metadata), \id.rs\ for opaque runtime identifiers, and \jspi.rs\ to provide JavaScript Promise-based suspension primitives for the Emscripten target.
tokio/src/runtime · high confidence
Behavioural changes
Add local documentation stubs for Windows I/O types
The \tokio::doc\ module now includes local type aliases and trait stubs for Windows-specific I/O primitives (such as \RawHandle\, \OwnedHandle\, \AsRawHandle\, \AsHandle\, etc.) that mirror \std::os::windows::io\. These stubs are visible in the generated documentation to provide cross-references and context for users, but the types are uninhabitable and cannot be used in application code.
tokio/src/doc · high confidence
DelayQueue moved to tokio-util
The \DelayQueue\ type, previously part of the core \tokio\ crate, is now available in \tokio-util\ under the \tokio\_util::time\ module. Users must update their imports to use \tokio\_util::time::DelayQueue\ instead of \tokio::time::DelayQueue\.
tokio-util/src/time · high confidence
Internal refactoring of future combinators and runtime blocking logic
The \tokio/src/future\ module has been restructured to improve internal organization and reduce unsafe code usage. The \MaybeDone\ combinator, used to track the completion state of futures, has been rewritten to use \pin-project-lite\ instead of the heavier \pin-project\ crate, and its implementation no longer relies on unsafe code. A new internal \try\_join3\ implementation has been added to support joining three fallible futures, leveraging the updated \MaybeDone\ logic. Additionally, the \block\_on\ function, which blocks the current thread until a future completes, has been moved into this module and now uses \\#\[track\_caller\]\ to provide better error location information when blocking occurs within a runtime context.
tokio/src/future · high confidence
Introduction of a sharded queue for blocking tasks to improve scalability
The blocking thread pool now supports a sharded task queue implementation, which distributes tasks across multiple independent queues to reduce lock contention and improve scalability when spawning blocking operations. This new architecture is integrated into the \tokio/src/runtime/blocking\ module, which also includes the pool management, shutdown coordination, and task scheduling logic required to support this change.
tokio/src/runtime/blocking · high confidence
New internal utilities for safe polling and optimized byte searching
This change introduces new internal helper modules in \tokio-util/src/util\ to support existing public APIs. The \poll\_buf\ module adds \poll\_read\_buf\ and \poll\_write\_buf\ functions, which provide efficient, buffer-aware polling for \AsyncRead\ and \AsyncWrite\ operations, supporting vectored writes where available. The \maybe\_dangling\ module provides a \MaybeDangling\ wrapper to safely handle self-referential structs and references during polling, preventing invalid compiler assumptions about reference validity. Additionally, the \memchr\ module adds a utility for searching byte arrays, using \libc::memchr\ on Unix systems when the \libc\ feature is enabled for performance, falling back to a standard iterator otherwise. These components are internal implementation details used by other parts of the library (such as codecs and IO utilities) rather than direct user-facing features.
tokio-util/src/util · high confidence
Redesign of mpsc channel internals with block-based lock-free list
The \tokio::sync::mpsc\ module has been refactored to use a new block-based, lock-free linked list implementation (\block.rs\, \list.rs\) to store messages, replacing the previous internal structure. This change introduces a \Semaphore\ trait in \chan.rs\ to abstract capacity management, allowing both bounded channels (using \batch\_semaphore\) and unbounded channels (using a simple atomic counter) to share the same core channel logic. The public API surface in \bounded.rs\ and \unbounded.rs\ remains consistent, but the underlying storage now organizes messages into fixed-capacity blocks (32 slots on 64-bit, 16 on 32-bit) to improve cache locality and reduce allocation overhead.
tokio/src/sync/mpsc · high confidence
Refactored internal time driver architecture
The internal time driver implementation has been restructured to improve concurrency safety and clarity. Timer state is now managed via a dedicated \StateCell\ in \entry.rs\ that uses atomic operations and explicit locking rules to synchronize between the timer entry and the driver, preventing race conditions during resets and firings. The driver's internal state is encapsulated in a new \Handle\ struct (\handle.rs\) and a \TimeSource\ abstraction (\source.rs\) that converts \Instant\ values to internal tick counts, decoupling the timer logic from direct \Instant\ usage. The main driver module (\mod.rs\) now clearly separates the traditional timer wheel implementation from an alternative multi-threaded variant, organizing the shared state and shutdown logic more robustly.
tokio/src/runtime/time · high confidence
Refactored multi-thread scheduler inject queue internals
The internal implementation of the multi-thread scheduler's inject queue has been restructured to improve code organization and concurrency handling. The queue logic is now split into dedicated modules: \shared.rs\ manages the atomic length counter and linked-list state, \synced.rs\ handles the mutex-protected queue head/tail and closure status, \pop.rs\ provides an iterator for draining tasks, and \rt\_multi\_thread.rs\ defines the \InjectQueue\ enum that dispatches operations to the underlying lock topology. This change isolates the synchronization primitives and task iteration logic, making the inject queue's behavior more explicit and maintainable without altering the external API.
tokio/src/runtime/scheduler/inject · high confidence
Signal driver now delegates to the I/O driver
The signal driver implementation has been refactored to rely directly on the I/O driver for handling wakeups and parking, rather than managing its own independent event loop. This change consolidates signal handling into the existing I/O infrastructure, ensuring that signal notifications are processed through the same mechanism as other I/O events.
tokio/src/runtime/signal · high confidence
Task dumps now include task IDs and metrics are stabilized
Task dumps generated by the multi-thread scheduler now include the specific \Id\ for each task, allowing users to identify tasks more precisely in diagnostic output. Additionally, the \injection\_queue\_depth\ metric has been stabilized for production use, while the \worker\_local\_queue\_depth\ metric remains behind the unstable metrics feature flag. These changes improve observability and debugging capabilities for runtime internals.
_tokio/src/runtime/scheduler/multi\thread/worker · high confidence
Unified loom mocking layer for concurrent testing
The \tokio/src/loom\ module now provides a single, unified abstraction layer for concurrent testing. By introducing a \mocked.rs\ module that wraps \loom\ primitives (such as \Mutex\ and \RwLock\) and a \mod.rs\ that conditionally selects between standard synchronization and the mocked implementation, the library ensures consistent behavior during \loom\-based model checking. This change standardizes how internal synchronization primitives are exposed to the rest of the codebase when running in a testing context, simplifying the testing infrastructure.
tokio/src/loom · high confidence
Unified loom/std synchronization primitives with unsync loads and poisoned-lock handling
The \tokio/src/loom/std\ module now provides a consistent set of internal synchronization primitives for the loom testing framework. Atomic types (\AtomicU16\, \AtomicU32\, \AtomicUsize\) now expose an \unsync\_load\ method for optimized, unsynchronized reads, while \AtomicU64\ is implemented using a \Mutex\ on platforms lacking native 64-bit atomics. Standard \Mutex\ and \RwLock\ wrappers automatically recover from poisoning by extracting the inner value, and a new \Barrier\ type supports \wait\_timeout\ for bounded synchronization waits.
tokio/src/loom/std · high confidence
Unix child process handling now uses pidfd on Linux when available
On Linux, Tokio now attempts to use pidfd (process file descriptors) to monitor and reap child processes instead of relying solely on SIGCHLD signals. This change improves reliability by avoiding issues with spurious wakeups and signal coalescing, and it is implemented via a new \PidfdReaper\ that falls back to the existing signal-based \Reaper\ if pidfd support is not available in the kernel.
tokio/src/process/unix · high confidence
Test coverage
Add fuzzing harness for internal linked list; Added TCP echo stress test example; Added build and clippy tests for macros; Added compile-fail tests for tokio macros; Added fuzz test for StreamMap; Added integration test binaries for I/O, memory, and signal handling; Added integration tests for macros, process stdio, and runtime behavior; Added loom concurrency tests for CancellationToken; Added loom-based concurrency tests for the multi-threaded runtime; Added loom-based concurrency tests for tokio sync primitives; Added mock-based tests for tokio::fs::File I/O operations; Added test coverage for tokio macro edge cases; Added test support utilities for io\_uring, I/O vectors, and panic handling; Added tests for the time driver's TimerEntry; Added tests for tokio-stream components; Added tests for tokio-test utilities; Comprehensive test suite for tokio-util components; Expanded runtime test coverage with loom and stress tests; Expanded test coverage for Tokio core components; Expose Tokio dependency in build tests; Removal of legacy futures-io integration tests.
Dependencies
Tokio 1.53.2 release and workspace dependency updates
This release updates the Tokio runtime to version 1.53.2 and raises the Minimum Supported Rust Version (MSRV) to 1.85 across the workspace. It also bumps tokio-util to 0.7.20, tokio-stream to 0.1.19, tokio-test to 0.4.6, and tokio-macros to 2.7.2. The examples crate now depends on the \http\ crate version 1, and the \benches\ crate has been updated to use \criterion\ 0.5.1 and \rand\ 0.9.
(dependencies) · high confidence
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
Score
- CAI 70 → 71 (+0.5)
- Rubric changed (rubric-2026.10.5 → rubric-2026.11.4) — scores are not directly comparable.
Lenses
- Code Health 95 → 94 (-1.0)
- Architecture 91 → 91 (+0.0)
- Maturity 60 → 61 (+1.0)
- Readiness 79 → 80 (+0.6)
- Security 71 → 71 (+0.0)
- Performance 94 → 94 (+0.0)
Resolved (32)
- Change coupling: listener.rs ↔ listener.rs (tokio/src/net/tcp/listener.rs)
- Change coupling: udp.rs ↔ listener.rs (tokio/src/net/udp.rs)
- Change-coupling hub: socket.rs → udp.rs, listener.rs, stream.rs (tokio/src/net/unix/datagram/socket.rs)
- Change-coupling hub: stream.rs → udp.rs, socket.rs, listener.rs, stream.rs (tokio/src/net/tcp/stream.rs)
- Duplicated block (12 lines × 3) (tokio/src/sync/mutex.rs)
- Duplicated block (13 lines × 2) (tokio/src/io/async_fd.rs)
- Duplicated block (13 lines × 2) (tokio/src/io/util/copy.rs)
- Duplicated block (13 lines × 3) (tokio/src/sync/mutex.rs)
- Duplicated block (15 lines × 2) (tokio-util/src/codec/framed_read.rs)
- Duplicated block (15 lines × 2) (tokio/src/io/util/copy.rs)
- Duplicated block (17 lines × 6) (tokio/src/fs/open_options.rs)
- Duplicated block (18 lines × 2) (tokio/src/fs/file.rs)
- Duplicated block (19 lines × 2) (tokio/src/runtime/time/wheel/level.rs)
- Duplicated block (5 lines × 2) (tokio-util/src/time/delay_queue.rs)
- Duplicated block (5 lines × 2) (tokio/src/fs/file.rs)
- Duplicated block (6 lines × 3) (tokio/src/net/tcp/listener.rs)
- Duplicated block (8 lines × 2) (tokio-macros/src/entry.rs)
- Duplicated block (8 lines × 2) (tokio/src/io/util/mem.rs)
- FixmeComment (tokio/src/fs/try_exists.rs)
- FixmeComment (tokio/src/fs/try_exists.rs)
- …and 12 more
New (111)
- Change coupling: stream.rs ↔ stream.rs (tokio/src/net/tcp/stream.rs)
- Change-coupling hub: listener.rs → listener.rs, stream.rs, udp.rs (tokio/src/net/unix/listener.rs)
- Change-coupling hub: socket.rs → stream.rs, udp.rs, listener.rs, stream.rs (tokio/src/net/unix/datagram/socket.rs)
- Duplicated block (10 lines × 2) (tokio/src/runtime/time/wheel/mod.rs)
- Duplicated block (10–11 lines × 2) (tokio/src/runtime/scheduler/multi_thread/worker.rs)
- Duplicated block (13 lines × 2) (tokio/src/io/async_fd.rs)
- Duplicated block (13 lines × 2) (tokio/src/io/util/copy.rs)
- Duplicated block (13 lines × 3) (tokio/src/sync/mutex.rs)
- Duplicated block (15 lines × 2) (tokio-util/src/codec/framed_read.rs)
- Duplicated block (15 lines × 2) (tokio/src/io/util/copy.rs)
- Duplicated block (18 lines × 2) (tokio/src/fs/file.rs)
- Duplicated block (19 lines × 2) (tokio/src/runtime/time/wheel/level.rs)
- Duplicated block (5 lines × 2) (tokio-util/src/time/delay_queue.rs)
- Duplicated block (6 lines × 3) (tokio/src/net/tcp/listener.rs)
- Duplicated block (8 lines × 2) (tokio-macros/src/entry.rs)
- Duplicated block (8 lines × 2) (tokio/src/io/util/mem.rs)
- Edited copies of one member (3 members, 11+ corresponding lines) (tokio/src/sync/batch_semaphore.rs)
- Edited copies of one member (3 members, 11+ corresponding lines) (tokio/src/sync/mutex.rs)
- Edited copies of one member (3 members, 13+ corresponding lines) (tokio-util/src/time/wheel/level.rs)
- Edited copies of one member (3 members, 18+ corresponding lines) (tokio/src/sync/semaphore.rs)
- …and 91 more
Changes since last survey
- 37 commits — 34 feature/other, 3 fixes
By area
- tokio/src — 24 commits
- (repo) — 3 commits
- tokio-stream/src — 3 commits
- tokio-util/src — 2 commits
- (root) — 1 commit
- .github/workflows — 1 commit
- tokio-stream/Cargo.toml — 1 commit
- tokio-test/src — 1 commit
- tokio/tests — 1 commit
Notable commits
- fix: rt: fix io_uring shutdown errors (#8634)
- fix: rt: fix io_uring shutdown errors (#8634) (#8736)
- fix: util: fix spawn_pinned source location for console (#8753)
- change: Merge 'tokio-1.51.x' into 'tokio-1.53.x' (#8763)
- change: Merge 'tokio-1.53.x' into 'tokio-1.54.x' (#8764)
- change: Merge 'tokio-1.54.x' into 'master' (#8765)
- change: ci: ignore RUSTSEC-2026-0441 in cargo-deny (#8762)
- change: codec: clarify read buffer mutation requirements (#8690)
- change: deps: update parking_lot to 0.13 (#8745)
- change: fs: use std::fs::exists in try_exists (#8651)
- change: fs: wait for in-flight writes in File::metadata (#8751)
- change: io: add CopyToBytes::get_pin_mut and SinkWriter::get_pin_mut (#8707)
- change: io: don't clear readiness after a short read on pipes (#8593)
- change: io: drop replaced wakers outside the I/O driver locks (#8706)
- change: io: only validate appended bytes in read_line (#8717)
- change: io: test I/O registration races during driver shutdown (#8631)
- change: macros: suppress clippy::redundant_pub_crate in select! (#8712)
- change: net: add TcpListener::take_error (#8730)
- change: process: close child stdin on shutdown (#8619)
- change: process: enqueue orphans when spawn setup fails after OS spawn (#8359)
- …and 17 more
Written by cca.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
tokio-rs/tokio was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 14 November 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit ab0814fc8c62b3d8be40aad068e2fed6562cfeb0 — the exact code this score is about.
- Scored under rubric-2026.11.4 — the same rubric and the same method as every other entry in this index.
- Measured by Canine Code Analyzer (cca.canine.dev) using cca measure-2026.11.65+preprod-36d4cd83012f.