Re: io_uring_peek_cqe and EAGAIN

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello Jens,

Thank you for your answer on this newbie question :)

On Wed, Apr 22, 2020 at 10:57 PM Jens Axboe <axboe@xxxxxxxxx> wrote:
> I don't think the change is correct. That's not saying that the original
> code is necessarily correct, though! Basically there are two cases there:
>
> 1) We haven't gotten a completion yet, we'll wait for it.
> 2) We already found at least one completion. We don't want
>    to _wait_ for more, but we can peek and see if there are more.
>
> Hence we don't want to turn case 2 into a loop, we should just
> continue.

ok so in fact I think I understand that my usage is incorrect:
1- if I'm in the case of being able to do other things while waiting
for data available using `io_uring_peek_cqe`, I should use it and come
back later when getting a -EAGAIN.
2- it is useless to do a loop on `io_uring_peek_cqe` because in that
case, I should simply do a `io_uring_wait_cqe`

is that correct?

> How is it currently failing for you?

While trying to open/read/close multiple files, I first thought that,
because I had one successful `io_uring_wait_cqe`, I could then loop on
`io_uring_peek_cqe` and get all my data. I now realise my assumption
was completely wrong and this example was just written that way to
show two different possibilities of getting results.
-- 
William



[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux