__io_uring_peek_cqe() doesn't consume cqe it returns, no need to decrease wait_nr because we check against the number in CQ as well as the kernel do. One exception for that behaviour is IOPOLL, but that kernel will return if there is anything in CQ, so will work just fine. Signed-off-by: Pavel Begunkov <asml.silence@xxxxxxxxx> --- src/queue.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/queue.c b/src/queue.c index 94f791e..dd1df2a 100644 --- a/src/queue.c +++ b/src/queue.c @@ -106,8 +106,6 @@ static int _io_uring_get_cqe(struct io_uring *ring, struct io_uring_cqe **cqe_pt } cq_overflow_flush = true; } - if (data->wait_nr && cqe) - data->wait_nr--; if (data->wait_nr || cq_overflow_flush) flags = IORING_ENTER_GETEVENTS | data->get_flags; if (data->submit) -- 2.24.0