… | |
… | |
310 | uint32_t gen = ev->data >> 32; |
310 | uint32_t gen = ev->data >> 32; |
311 | int res = ev->res; |
311 | int res = ev->res; |
312 | |
312 | |
313 | assert (("libev: iocb fd must be in-bounds", fd >= 0 && fd < anfdmax)); |
313 | assert (("libev: iocb fd must be in-bounds", fd >= 0 && fd < anfdmax)); |
314 | |
314 | |
315 | /* ignore event if generation doesn't match */ |
315 | /* only accept events if generation counter matches */ |
316 | if (ecb_expect_false (gen != (uint32_t)anfds [fd].egen)) |
316 | if (ecb_expect_true (gen == (uint32_t)anfds [fd].egen)) |
317 | continue; |
317 | { |
318 | |
|
|
319 | /* feed events, we do not expect or handle POLLNVAL */ |
318 | /* feed events, we do not expect or handle POLLNVAL */ |
320 | fd_event ( |
319 | fd_event ( |
321 | EV_A_ |
320 | EV_A_ |
322 | fd, |
321 | fd, |
323 | (res & (POLLOUT | POLLERR | POLLHUP) ? EV_WRITE : 0) |
322 | (res & (POLLOUT | POLLERR | POLLHUP) ? EV_WRITE : 0) |
324 | | (res & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0) |
323 | | (res & (POLLIN | POLLERR | POLLHUP) ? EV_READ : 0) |
325 | ); |
324 | ); |
326 | |
325 | |
327 | /* linux aio is oneshot: rearm fd. TODO: this does more work than strictly needed */ |
326 | /* linux aio is oneshot: rearm fd. TODO: this does more work than strictly needed */ |
328 | linuxaio_fd_rearm (EV_A_ fd); |
327 | linuxaio_fd_rearm (EV_A_ fd); |
|
|
328 | } |
329 | |
329 | |
330 | --nr; |
330 | --nr; |
331 | ++ev; |
331 | ++ev; |
332 | } |
332 | } |
333 | } |
333 | } |
… | |
… | |
437 | break; |
437 | break; |
438 | } |
438 | } |
439 | else |
439 | else |
440 | break; /* no events from the kernel, we are done */ |
440 | break; /* no events from the kernel, we are done */ |
441 | |
441 | |
442 | timeout = 0; /* only wait in the first iteration */ |
442 | timeout = EV_TS_CONST (0.); /* only wait in the first iteration */ |
443 | } |
443 | } |
444 | } |
444 | } |
445 | |
445 | |
446 | inline_size |
446 | inline_size |
447 | int |
447 | int |
… | |
… | |
517 | backend = EVBACKEND_EPOLL; |
517 | backend = EVBACKEND_EPOLL; |
518 | backend_modify = epoll_modify; |
518 | backend_modify = epoll_modify; |
519 | backend_poll = epoll_poll; |
519 | backend_poll = epoll_poll; |
520 | } |
520 | } |
521 | |
521 | |
522 | timeout = 0; |
522 | timeout = EV_TS_CONST (0.); |
523 | /* it's easiest to handle this mess in another iteration */ |
523 | /* it's easiest to handle this mess in another iteration */ |
524 | return; |
524 | return; |
525 | } |
525 | } |
526 | else if (errno == EBADF) |
526 | else if (errno == EBADF) |
527 | { |
527 | { |