fn copy_cqes(self: *IO_Uring, cqes: []linux.io_uring_cqe, wait_nr: u32) !u32

Copies as many CQEs as are ready, and that can fit into the destination cqes slice. If none are available, enters into the kernel to wait for at most wait_nr CQEs. Returns the number of CQEs copied, advancing the CQ ring. Provides all the wait/peek methods found in liburing, but with batching and a single method. The rationale for copying CQEs rather than copying pointers is that pointers are 8 bytes whereas CQEs are not much more at only 16 bytes, and this provides a safer faster interface. Safer, because you no longer need to call cqe_seen(), avoiding idempotency bugs. Faster, because we can now amortize the atomic store release to cq.head across the batch. See https://github.com/axboe/liburing/issues/103#issuecomment-686665007. Matches the implementation of io_uring_peek_batch_cqe() in liburing, but supports waiting.

Parameters

self: *IO_Uring,
wait_nr: u32,