From 6aa5ed020ef20175e190d1e73475ba361aa30821 Mon Sep 17 00:00:00 2001 From: 4lDO2 <4lDO2@protonmail.com> Date: Sat, 15 Jun 2024 12:29:05 +0200 Subject: [PATCH] Add missing fevent impl for RootScheme. --- src/scheme/user.rs | 10 ++++++++-- src/sync/wait_queue.rs | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/scheme/user.rs b/src/scheme/user.rs index 1ae6c67df6..1c8b4ecbad 100644 --- a/src/scheme/user.rs +++ b/src/scheme/user.rs @@ -919,8 +919,14 @@ impl UserInner { Ok(()) } - pub fn fevent(&self, _flags: EventFlags) -> Result { - Ok(EventFlags::empty()) + pub fn fevent(&self, flags: EventFlags) -> Result { + // TODO: Should the root scheme also suppress events if `flags` does not contain + // `EVENT_READ`? + Ok(if self.todo.is_currently_empty() { + EventFlags::empty() + } else { + EventFlags::EVENT_READ.intersection(flags) + }) } pub fn fsync(&self) -> Result<()> { diff --git a/src/sync/wait_queue.rs b/src/sync/wait_queue.rs index c7b91f1191..fa9d7962a7 100644 --- a/src/sync/wait_queue.rs +++ b/src/sync/wait_queue.rs @@ -23,6 +23,9 @@ impl WaitQueue { condition: WaitCondition::new(), } } + pub fn is_currently_empty(&self) -> bool { + self.inner.lock().is_empty() + } pub fn receive(&self, block: bool, reason: &'static str) -> Result { loop {