mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-25 00:00:18 +02:00
time: fix reversed poll order in timeout doc (#8214)
The timeout doc said the timeout is checked before polling the future, but the impl polls the future first and only then checks the delay (see the Future impl for Timeout, which calls me.value.poll before poll_delay). Reverse the clause to match the implementation. This is also what makes the rest of the sentence correct: the future can complete and exceed the timeout without an error precisely because it is polled before the timeout is checked. Co-authored-by: Patrick Wehbe <[email protected]>
This commit is contained in:
co-authored by
Patrick Wehbe
parent
daa653d94f
commit
66e29121b3
@@ -21,7 +21,7 @@ use std::task::{self, Poll};
|
||||
/// value is returned. Otherwise, an error is returned and the future is
|
||||
/// canceled.
|
||||
///
|
||||
/// Note that the timeout is checked before polling the future, so if the future
|
||||
/// Note that the future is polled before the timeout is checked, so if the future
|
||||
/// does not yield during execution then it is possible for the future to complete
|
||||
/// and exceed the timeout _without_ returning an error.
|
||||
///
|
||||
|
||||
Reference in New Issue
Block a user