Solve borrow checking by downgrading condition.wait lock

This commit is contained in:
Wildan M
2026-03-11 09:07:52 +07:00
parent 046c8ced0d
commit 60573e24f3
7 changed files with 65 additions and 28 deletions
+2 -1
View File
@@ -35,10 +35,11 @@ impl<T> WaitQueue<T> {
) -> Result<usize> {
loop {
let mut inner = self.inner.lock();
let mut token = token.downgrade();
if inner.is_empty() {
if block {
if !self.condition.wait(inner, reason, token) {
if !self.condition.wait(inner, reason, &mut token) {
return Err(Error::new(EINTR));
}
continue;