From 5402c948eebbb4c6c695e156d68ce495a43ea81a Mon Sep 17 00:00:00 2001 From: Henry Gomersall Date: Sun, 17 Jan 2021 20:39:58 +0000 Subject: [PATCH] io: clarify AsyncFd docs about changes of the inner fd (#3430) --- tokio/src/io/async_fd.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tokio/src/io/async_fd.rs b/tokio/src/io/async_fd.rs index 08d7b91f5..13f4f2d62 100644 --- a/tokio/src/io/async_fd.rs +++ b/tokio/src/io/async_fd.rs @@ -23,9 +23,11 @@ use std::{task::Context, task::Poll}; /// to retake control from the tokio IO reactor. /// /// The inner object is required to implement [`AsRawFd`]. This file descriptor -/// must not change while [`AsyncFd`] owns the inner object. Changing the file -/// descriptor results in unspecified behavior in the IO driver, which may -/// include breaking notifications for other sockets/etc. +/// must not change while [`AsyncFd`] owns the inner object, i.e. the +/// [`AsRawFd::as_raw_fd`] method on the inner type must always return the same +/// file descriptor when called multiple times. Failure to uphold this results +/// in unspecified behavior in the IO driver, which may include breaking +/// notifications for other sockets/etc. /// /// Polling for readiness is done by calling the async functions [`readable`] /// and [`writable`]. These functions complete when the associated readiness