Extra comments
This commit is contained in:
@@ -72,7 +72,10 @@ impl StdinPoll {
|
|||||||
fn event_loop(request_rx: Receiver<()>, notify_tx: Sender<PollState>) -> ! {
|
fn event_loop(request_rx: Receiver<()>, notify_tx: Sender<PollState>) -> ! {
|
||||||
use std::io::BufRead;
|
use std::io::BufRead;
|
||||||
loop {
|
loop {
|
||||||
|
// Wait for the request to poll stdin
|
||||||
request_rx.recv().expect("request_rx channel closed");
|
request_rx.recv().expect("request_rx channel closed");
|
||||||
|
|
||||||
|
// Wait for data to appear in stdin.
|
||||||
// If `fill_buf` returns any slice, then it means that either
|
// If `fill_buf` returns any slice, then it means that either
|
||||||
// (a) there some data in stdout, if it's non-empty
|
// (a) there some data in stdout, if it's non-empty
|
||||||
// (b) EOF was received, if it's empty
|
// (b) EOF was received, if it's empty
|
||||||
@@ -81,6 +84,9 @@ impl StdinPoll {
|
|||||||
Ok(_) => PollState::Ready,
|
Ok(_) => PollState::Ready,
|
||||||
Err(e) => PollState::Error(e.into()),
|
Err(e) => PollState::Error(e.into()),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Notify the requestor about data in stdin. They may have already timed out,
|
||||||
|
// then the next requestor will have to clean the channel.
|
||||||
notify_tx.send(resp).expect("notify_tx channel closed");
|
notify_tx.send(resp).expect("notify_tx channel closed");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user