I want to experiment io_uring on the github project: https://github.com/alexhultman/io_uring_epoll_benchmark
referrence: https://unixism.net/loti/ref-liburing/completion.html
however I stumbled upon 2 functions:
unsigned io_uring_peek_batch_cqe(struct io_uring *ring, struct io_uring_cqe **cqes, unsigned count)
int io_uring_wait_cqe_nr(struct io_uring *ring, struct io_uring_cqe **cqe_ptr, unsigned wait_nr)
I understand that the first functions will fills in an array of I/O completions up to count to the cqes and will return regardless of how many cqes completions
However the second functions only fills in one I/O completions to the cqes even I wait for wait_nr completions, why is this so, if it wait for specific number of cqes completions, why i didn't fill in the array of I/O like the first function did?
like example i create: #define MAX_BATCH 2000
struct io_uring_cqe **cqes = malloc(sizeof(struct io_uring_cqe *) * MAX_BATCH);
if I run on the first function, i could access cqes[i] i = (0 to completions)
if I run on the second function, I can only access cqes[i] i = 0
I need to understand why the second function never update the array of cqes like the first function did