io_uring_cq_advance(3)

πŸ’– io_uring_cq_advance(3) β€” liburing Manual πŸ’–

okay bestie, welcome to the liburing girlies' guide to telling the kernel "yeah I saw that, next" πŸ’…


✨ NAME ✨

io_uring_cq_advance β€” mark one or more io_uring completion events as consumed


🌸 SYNOPSIS 🌸

#include <liburing.h>

void io_uring_cq_advance(struct io_uring *ring,
                          unsigned nr);

πŸ¦‹ DESCRIPTION πŸ¦‹

so like, io_uring_cq_advance(3) marks nr IO completions belonging to the ring param as consumed. that's it. that's the whole job. no cap. πŸŽ€

here's the vibe: after the caller has submitted a request with io_uring_submit(3), the application can retrieve the completion with io_uring_wait_cqe(3), io_uring_peek_cqe(3), or any of the other CQE retrieval helpers, and then mark it as consumed with io_uring_cqe_seen(3). iconic behavior honestly. ✨

and plot twist β€” the function io_uring_cqe_seen(3) calls the function io_uring_cq_advance(3). so it's giving "you've been calling it this whole time without knowing." 😭

now listen up because this is the important part πŸ‘‘: completions must be marked as seen, so their slot can get reused. failure to do so will result in the same completion being returned on the next invocation. that's not a cute little quirk, that's a bug in your app. don't be that girl. 🚫


πŸŽ€ RETURN VALUE πŸŽ€

None πŸ’€ β€” it's a void function, she returns nothing, she just does.


🌈 SEE ALSO 🌈


and that's the whole page bestie 🫢 this one's from liburing-2.1, dated January 25, 2022 β€” so she's an elder but she's still slaying. go advance those completions, you're literally the main character of your own event loop. periodt. πŸ’œ

πŸ“¦ where this page comes from