Skip to content

Commit

Permalink
man/io_uring_for_each_cqe: Explicitly tell it's a macro and add an ex…
Browse files Browse the repository at this point in the history
…ample

Let the reader directly know that it's not a function, but a macro.
Also, give a simple example of its usage.

Co-authored-by: Alviro Iskandar Setiawan <[email protected]>
Signed-off-by: Alviro Iskandar Setiawan <[email protected]>
Signed-off-by: Ammar Faizi <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jens Axboe <[email protected]>
  • Loading branch information
2 people authored and axboe committed Jun 9, 2023
1 parent c8d06ed commit 298c083
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion man/io_uring_for_each_cqe.3
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ io_uring_for_each_cqe \- iterate pending completion events
.PP
The
.BR io_uring_for_each_cqe (3)
helper iterates completion events belonging to the
is a macro helper that iterates completion events belonging to the
.I ring
using
.I head
Expand All @@ -35,6 +35,24 @@ calling
.BR io_uring_cqe_seen (3)
for each of them.

.SH EXAMPLE
.EX
void handle_cqes(struct io_uring *ring)
{
struct io_uring_cqe *cqe;
unsigned head;
unsigned i = 0;
io_uring_for_each_cqe(ring, head, cqe) {
/* handle completion */
printf("cqe: %d\\n", cqe->res);
i++;
}
io_uring_cq_advance(ring, i);
}
.EE

.SH RETURN VALUE
None
.SH SEE ALSO
Expand Down

0 comments on commit 298c083

Please sign in to comment.