io: use Condvar::wait_while

This commit is contained in:
Johannes Altmanninger 2023-12-10 10:34:52 +01:00
parent 38d52b7835
commit c6f7933999

View File

@ -523,10 +523,8 @@ impl IoBuffer {
let mut promise = self.fill_waiter.borrow_mut();
let (mutex, condvar) = &**promise.as_ref().unwrap();
{
let mut done = mutex.lock().unwrap();
while !*done {
done = condvar.wait(done).unwrap();
}
let done_guard = mutex.lock().unwrap();
let _done_guard = condvar.wait_while(done_guard, |done| !*done).unwrap();
}
*promise = None;