Partially solve borrow checking with WaitQueue

This commit is contained in:
Wildan M
2026-03-11 07:27:21 +07:00
parent 771ebdb39f
commit 44f2214971
3 changed files with 14 additions and 6 deletions
+6 -2
View File
@@ -3,7 +3,7 @@ use spin::Mutex;
use syscall::{EAGAIN, EINTR};
use crate::{
sync::{CleanLockToken, WaitCondition},
sync::{CleanLockToken, LockToken, WaitCondition, L1},
syscall::{
error::{Error, Result, EINVAL},
usercopy::UserSliceWo,
@@ -73,12 +73,16 @@ impl<T> WaitQueue<T> {
}
pub fn send(&self, value: T, token: &mut CleanLockToken) -> usize {
self.send_locked(value, &mut token.token().downgrade())
}
pub fn send_locked<'a>(&self, value: T, token: &'a mut LockToken<'a, L1>) -> usize {
let len = {
let mut inner = self.inner.lock();
inner.push_back(value);
inner.len()
};
self.condition.notify(token);
self.condition.notify_locked(token);
len
}
}