diff --git a/compio-driver/src/iour/mod.rs b/compio-driver/src/iour/mod.rs index eec2e761..a1cb9b2d 100644 --- a/compio-driver/src/iour/mod.rs +++ b/compio-driver/src/iour/mod.rs @@ -139,13 +139,17 @@ impl Driver { } } - fn poll_entries(&mut self, entries: &mut OutEntries) -> bool { + fn poll_blocking(&mut self, entries: &mut OutEntries) { // Cheaper than pop. if !self.pool_completed.is_empty() { while let Some(entry) = self.pool_completed.pop() { entries.notify(entry); } } + } + + fn poll_entries(&mut self, entries: &mut OutEntries) -> bool { + self.poll_blocking(entries); let mut cqueue = self.inner.completion(); cqueue.sync(); @@ -240,13 +244,13 @@ impl Driver { self.push_raw(entry.user_data(user_data as _), entries)?; Poll::Pending } - OpEntry::Blocking => { + OpEntry::Blocking => loop { if self.push_blocking(user_data)? { - Poll::Pending + break Poll::Pending; } else { - Poll::Ready(Err(io::Error::from_raw_os_error(libc::EBUSY))) + self.poll_blocking(entries); } - } + }, } }