about summary refs log tree commit diff
diff options
context:
space:
mode:
authorIan Jackson <ijackson@chiark.greenend.org.uk>2024-08-05 17:25:00 +0100
committerIan Jackson <ijackson@chiark.greenend.org.uk>2024-08-15 16:18:49 +0100
commit9a95573c2bb3e76643f0c1c4deb5eea24c37ec5c (patch)
tree50a1dce420cf1aeaf7dd63afc0ad228cbad76f92
parentc404406a87412d50604893d8c347744195ce2dea (diff)
Add cautionary paragraph about noop wakers.
Based on a suggestion from @kpreid, with some further editing.
-rw-r--r--library/core/src/task/wake.rs8
1 files changed, 8 insertions, 0 deletions
diff --git a/library/core/src/task/wake.rs b/library/core/src/task/wake.rs
index baa8a956f8a..4d2de6be025 100644
--- a/library/core/src/task/wake.rs
+++ b/library/core/src/task/wake.rs
@@ -539,6 +539,10 @@ impl Waker {
     /// some futures, but are not expecting those futures to wake the waker or
     /// do not need to do anything specific if it happens.
     ///
+    /// More generally, using `Waker::noop()` to poll a future
+    /// means discarding the notification of when the future should be polled again.
+    /// So it should only be used when such a notification will not be needed to make progress.
+    ///
     /// If an owned `Waker` is needed, `clone()` this one.
     ///
     /// # Examples
@@ -796,6 +800,10 @@ impl LocalWaker {
     /// some futures, but are not expecting those futures to wake the waker or
     /// do not need to do anything specific if it happens.
     ///
+    /// More generally, using `LocalWaker::noop()` to poll a future
+    /// means discarding the notification of when the future should be polled again,
+    /// So it should only be used when such a notification will not be needed to make progress.
+    ///
     /// If an owned `LocalWaker` is needed, `clone()` this one.
     ///
     /// # Examples