From c2e80ebb3001c95cc383e8ae354c6a00ff61a315 Mon Sep 17 00:00:00 2001 From: Alex Crichton Date: Mon, 26 Sep 2016 16:27:29 -0700 Subject: [PATCH] Indiciate need_read requires poll_read Original intention was that it didn't, but nowadays it does. Closes #44 --- src/reactor/poll_evented.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/reactor/poll_evented.rs b/src/reactor/poll_evented.rs index 1e9f9e338..5dd897136 100644 --- a/src/reactor/poll_evented.rs +++ b/src/reactor/poll_evented.rs @@ -107,6 +107,10 @@ impl PollEvented { /// The flag indicating that this stream is readable is unset and the /// current task is scheduled to receive a notification when the stream is /// then again readable. + /// + /// Note that it is also only valid to call this method if `poll_read` + /// previously indicated that the object is readable. That is, this function + /// must always be paired with calls to `poll_read` previously. pub fn need_read(&self) { self.readiness.fetch_and(!1, Ordering::SeqCst); self.token.schedule_read(&self.handle) @@ -123,6 +127,10 @@ impl PollEvented { /// The flag indicating that this stream is writable is unset and the /// current task is scheduled to receive a notification when the stream is /// then again writable. + /// + /// Note that it is also only valid to call this method if `poll_write` + /// previously indicated that the object is writeable. That is, this function + /// must always be paired with calls to `poll_write` previously. pub fn need_write(&self) { self.readiness.fetch_and(!2, Ordering::SeqCst); self.token.schedule_write(&self.handle)