Indiciate need_read requires poll_read

Original intention was that it didn't, but nowadays it does.

Closes #44
This commit is contained in:
Alex Crichton
2016-09-26 16:27:29 -07:00
parent 181dcdd9ea
commit c2e80ebb30
+8
View File
@@ -107,6 +107,10 @@ impl<E> PollEvented<E> {
/// 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<E> PollEvented<E> {
/// 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)