access-queue
access-queue copied to clipboard
Bug in AccessGuard::hold_and_reenqueue ?
This program never terminates:
use access_queue::*;
fn main() {
let queue = AccessQueue::new(0, 1);
futures::executor::block_on(async {
let guard = queue.access().await;
let (d, _) = guard.hold_and_reenqueue();
dbg!(d);
});
futures::executor::block_on(async {
let g = queue.access().await;
dbg!(*g);
});
}
Based on my understanding what hold_and_reenqueue should do, this program must terminate.
P.S. Probably this program freezes due missing self.queue.release(1); in hold_and_reenqueue.
If i'm wrong, I'm sorry.
hold_and_reenqueue specifically does not release, but then reenqueues a new access - it combines hold_indefinitely with reenqueue. You probably want to just use reenqueue.