If there are events to wait for, then account for one already complete. Signed-off-by: Bijan Mottahedeh <bijan.mottahedeh@xxxxxxxxxx> --- src/queue.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/queue.c b/src/queue.c index c7473c0..da2f405 100644 --- a/src/queue.c +++ b/src/queue.c @@ -49,6 +49,8 @@ int __io_uring_get_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_ptr, err = -EAGAIN; break; } + if (wait_nr && cqe) + wait_nr--; if (wait_nr) flags = IORING_ENTER_GETEVENTS; if (submit) -- 1.8.3.1