axboe / liburing

Library providing helpers for the Linux kernel io_uring support
MIT License
2.77k stars 398 forks source link

io_uring_wait_cqe_nr #1030

Closed cpporhair closed 8 months ago

cpporhair commented 8 months ago

Hi I use thread / per core to complete the logic. I want to be able to handle other tasks if there are no io completion events.

Is there any potential risk in using io_uring_wait_cqe_nr(&ring, &cqe, 0) if I want to get the completion event in a non-blocking way?

Or do you have a better way to do it?

axboe commented 8 months ago

That should work, or you can use io_uring_peek_cqe() which will check for a cqe without blocking.

cpporhair commented 8 months ago

OK.thx~~~