Skip to content

Commit

Permalink
Remove the poll_receive method from MonitorSocket.
Browse files Browse the repository at this point in the history
The `poll_receive` method from `Inner` is used directly instead
in the `Stream` implementation.

Signed-off-by: Jean Pierre Dudey <[email protected]>
  • Loading branch information
jeandudey committed Apr 26, 2018
1 parent 35e032e commit f84efe3
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions tokio-udev/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,15 +106,20 @@ impl MonitorSocket {
fn new(monitor: mio_udev::MonitorSocket) -> MonitorSocket {
MonitorSocket { inner: Mutex::new(Inner::new(monitor)), }
}

fn poll_receive(&mut self) -> Poll<Option<mio_udev::Event>, io::Error> {
self.inner.lock().unwrap().poll_receive()
}
}

unsafe impl Send for MonitorSocket {}
unsafe impl Sync for MonitorSocket {}

impl Stream for MonitorSocket {
type Item = mio_udev::Event;
type Error = io::Error;

fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
self.inner.lock().unwrap().poll_receive()
}
}

struct Inner {
io: PollEvented<mio_udev::MonitorSocket>,
}
Expand All @@ -139,12 +144,3 @@ impl Inner {

}
}

impl Stream for MonitorSocket {
type Item = mio_udev::Event;
type Error = io::Error;

fn poll(&mut self) -> Poll<Option<Self::Item>, Self::Error> {
self.poll_receive()
}
}

0 comments on commit f84efe3

Please sign in to comment.