summaryrefslogtreecommitdiffstats
path: root/tokio/src/lib.rs
diff options
context:
space:
mode:
authorbdonlan <bdonlan@gmail.com>2020-10-22 14:12:41 -0700
committerGitHub <noreply@github.com>2020-10-22 14:12:41 -0700
commitc1539132110d3f8d20d22efb4b3f6a16fafd0e63 (patch)
tree88dc81a22a3732da92f2327ee5bcc93b05f1cf5a /tokio/src/lib.rs
parent358e4f9f8029b6b289f8ef5a54bd7c6eae5bf969 (diff)
io: Add AsyncFd, fix io::driver shutdown (#2903)
* io: Add AsyncFd This adds AsyncFd, a unix-only structure to allow for read/writability states to be monitored for arbitrary file descriptors. Issue: #2728 * driver: fix shutdown notification unreliability Previously, there was a race window in which an IO driver shutting down could fail to notify ScheduledIo instances of this state; in particular, notification of outstanding ScheduledIo registrations was driven by `Driver::drop`, but registrations bypass `Driver` and go directly to a `Weak<Inner>`. The `Driver` holds the `Arc<Inner>` keeping `Inner` alive, but it's possible that a new handle could be registered (or a new readiness future created for an existing handle) after the `Driver::drop` handler runs and prior to `Inner` being dropped. This change fixes this in two parts: First, notification of outstanding ScheduledIo handles is pushed down into the drop method of `Inner` instead, and, second, we add state to ScheduledIo to ensure that we remember that the IO driver we're bound to has shut down after the initial shutdown notification, so that subsequent readiness future registrations can immediately return (instead of potentially blocking indefinitely). Fixes: #2924
Diffstat (limited to 'tokio/src/lib.rs')
-rw-r--r--tokio/src/lib.rs3
1 files changed, 2 insertions, 1 deletions
diff --git a/tokio/src/lib.rs b/tokio/src/lib.rs
index 66e266c3..690beab3 100644
--- a/tokio/src/lib.rs
+++ b/tokio/src/lib.rs
@@ -305,7 +305,8 @@
//! - `rt-multi-thread`: Enables the heavier, multi-threaded, work-stealing scheduler.
//! - `io-util`: Enables the IO based `Ext` traits.
//! - `io-std`: Enable `Stdout`, `Stdin` and `Stderr` types.
-//! - `net`: Enables `tokio::net` types such as `TcpStream`, `UnixStream` and `UdpSocket`.
+//! - `net`: Enables `tokio::net` types such as `TcpStream`, `UnixStream` and `UdpSocket`,
+//! as well as (on Unix-like systems) `AsyncFd`
//! - `time`: Enables `tokio::time` types and allows the schedulers to enable
//! the built in timer.
//! - `process`: Enables `tokio::process` types.