… | |
… | |
243 | /* we do it manually because the optimisations on epoll_modify won't do us any good */ |
243 | /* we do it manually because the optimisations on epoll_modify won't do us any good */ |
244 | epoll_ctl (backend_fd, EPOLL_CTL_DEL, fd, 0); |
244 | epoll_ctl (backend_fd, EPOLL_CTL_DEL, fd, 0); |
245 | anfds [fd].emask = 0; |
245 | anfds [fd].emask = 0; |
246 | iocb->io.aio_reqprio = 0; |
246 | iocb->io.aio_reqprio = 0; |
247 | } |
247 | } |
248 | |
|
|
249 | if (ecb_expect_false (iocb->io.aio_buf)) |
248 | else if (ecb_expect_false (iocb->io.aio_buf)) |
250 | { |
249 | { |
251 | /* iocb active, so cancel it first before resubmit */ |
250 | /* iocb active, so cancel it first before resubmit */ |
252 | for (;;) |
251 | for (;;) |
253 | { |
252 | { |
254 | /* on all relevant kernels, io_cancel fails with EINPROGRESS on "success" */ |
253 | /* on all relevant kernels, io_cancel fails with EINPROGRESS on "success" */ |
… | |
… | |
257 | |
256 | |
258 | if (ecb_expect_true (errno == EINPROGRESS)) |
257 | if (ecb_expect_true (errno == EINPROGRESS)) |
259 | break; |
258 | break; |
260 | |
259 | |
261 | /* the EINPROGRESS test is for nicer error message. clumsy. */ |
260 | /* the EINPROGRESS test is for nicer error message. clumsy. */ |
|
|
261 | if (errno != EINTR) |
|
|
262 | { |
262 | assert (("libev: linuxaio unexpected io_cancel failed", errno != EINPROGRESS && errno != EINTR)); |
263 | assert (("libev: linuxaio unexpected io_cancel failed", errno != EINTR && errno != EINPROGRESS)); |
|
|
264 | break; |
|
|
265 | } |
263 | } |
266 | } |
264 | } |
267 | } |
265 | |
268 | |
266 | iocb->io.aio_buf = |
269 | iocb->io.aio_buf = |
267 | (nev & EV_READ ? POLLIN : 0) |
270 | (nev & EV_READ ? POLLIN : 0) |