Improved scheme protocol.

This commit is contained in:
Jacob Lorentzon
2024-06-14 11:31:51 +00:00
committed by Jeremy Soller
parent e9ba024aaa
commit bf0fc66ac1
23 changed files with 874 additions and 748 deletions
+17
View File
@@ -24,6 +24,23 @@ impl<T> WaitQueue<T> {
}
}
pub fn receive(&self, block: bool, reason: &'static str) -> Result<T> {
loop {
let mut inner = self.inner.lock();
if let Some(t) = inner.pop_front() {
return Ok(t);
} else if block {
if !self.condition.wait(inner, reason) {
return Err(Error::new(EINTR));
}
continue;
} else {
return Err(Error::new(EAGAIN));
}
}
}
pub fn receive_into_user(
&self,
buf: UserSliceWo,