sys_util: poll: add iter_writable to set of methods for PollEvents

There were already methods for the readable and hungup events, so this
completes the set.

TEST=None
BUG=chromium:1023975

Change-Id: Ie9cd1459893cc8b6ba7a52e638e164095ddbcba5
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1930404
Tested-by: kokoro <noreply+kokoro@google.com>
Reviewed-by: Stephen Barber <smbarber@chromium.org>
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
This commit is contained in:
Zach Reizner 2019-11-22 17:11:03 -08:00 committed by Commit Bot
parent 1a2683b90d
commit e3f1271842

View file

@ -201,6 +201,15 @@ impl<'a, T: PollToken> PollEvents<'a, T> {
}
}
/// Iterates over each writable event.
pub fn iter_writable(&self) -> PollEventIter<slice::Iter<epoll_event>, T> {
PollEventIter {
mask: EPOLLOUT as u32,
iter: self.events[..self.count].iter(),
tokens: PhantomData,
}
}
/// Iterates over each hungup event.
pub fn iter_hungup(&self) -> PollEventIter<slice::Iter<epoll_event>, T> {
PollEventIter {