MutexBlocking works correctly.
This commit is contained in:
parent
6c45c33b41
commit
1a7420ac97
2 changed files with 10 additions and 8 deletions
|
@ -79,9 +79,10 @@ impl Mutex for MutexBlocking {
|
|||
fn unlock(&self) {
|
||||
let mut mutex_inner = self.inner.exclusive_access();
|
||||
assert_eq!(mutex_inner.locked, true);
|
||||
mutex_inner.locked = false;
|
||||
if let Some(waking_task) = mutex_inner.wait_queue.pop_front() {
|
||||
add_task(waking_task);
|
||||
} else {
|
||||
mutex_inner.locked = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue