Avoid duplicate wait_events methods

This commit is contained in:
Ruihan Li
2024-06-30 22:38:28 +08:00
committed by Tate, Hongliang Tian
parent 6e8896165d
commit ab9941263b
11 changed files with 126 additions and 134 deletions

View File

@ -9,7 +9,10 @@ use super::{
use crate::{
events::{IoEvents, Observer},
prelude::*,
process::{signal::Poller, Gid, Uid},
process::{
signal::{Pollable, Poller},
Gid, Uid,
},
time::clocks::RealTimeCoarseClock,
};
@ -23,15 +26,17 @@ impl PipeReader {
}
}
impl Pollable for PipeReader {
fn poll(&self, mask: IoEvents, poller: Option<&Poller>) -> IoEvents {
self.consumer.poll(mask, poller)
}
}
impl FileLike for PipeReader {
fn read(&self, buf: &mut [u8]) -> Result<usize> {
self.consumer.read(buf)
}
fn poll(&self, mask: IoEvents, poller: Option<&Poller>) -> IoEvents {
self.consumer.poll(mask, poller)
}
fn status_flags(&self) -> StatusFlags {
self.consumer.status_flags()
}
@ -90,15 +95,17 @@ impl PipeWriter {
}
}
impl Pollable for PipeWriter {
fn poll(&self, mask: IoEvents, poller: Option<&Poller>) -> IoEvents {
self.producer.poll(mask, poller)
}
}
impl FileLike for PipeWriter {
fn write(&self, buf: &[u8]) -> Result<usize> {
self.producer.write(buf)
}
fn poll(&self, mask: IoEvents, poller: Option<&Poller>) -> IoEvents {
self.producer.poll(mask, poller)
}
fn status_flags(&self) -> StatusFlags {
self.producer.status_flags()
}