… | |
… | |
576 | timeout = EV_TS_CONST (0.); |
576 | timeout = EV_TS_CONST (0.); |
577 | else |
577 | else |
578 | /* no events, so maybe wait for some */ |
578 | /* no events, so maybe wait for some */ |
579 | iouring_tfd_update (EV_A_ timeout); |
579 | iouring_tfd_update (EV_A_ timeout); |
580 | |
580 | |
581 | /* only enter the kernel if we have somethign to submit, or we need to wait */ |
581 | /* only enter the kernel if we have something to submit, or we need to wait */ |
582 | if (timeout || iouring_to_submit) |
582 | if (timeout || iouring_to_submit) |
583 | { |
583 | { |
584 | int res; |
584 | int res; |
585 | |
585 | |
586 | EV_RELEASE_CB; |
586 | EV_RELEASE_CB; |
… | |
… | |
606 | iouring_init (EV_P_ int flags) |
606 | iouring_init (EV_P_ int flags) |
607 | { |
607 | { |
608 | if (!epoll_init (EV_A_ 0)) |
608 | if (!epoll_init (EV_A_ 0)) |
609 | return 0; |
609 | return 0; |
610 | |
610 | |
|
|
611 | iouring_entries = IOURING_INIT_ENTRIES; |
|
|
612 | iouring_max_entries = 0; |
|
|
613 | |
|
|
614 | if (iouring_internal_init (EV_A) < 0) |
|
|
615 | { |
|
|
616 | iouring_internal_destroy (EV_A); |
|
|
617 | return 0; |
|
|
618 | } |
|
|
619 | |
611 | ev_io_init (&iouring_epoll_w, iouring_epoll_cb, backend_fd, EV_READ); |
620 | ev_io_init (&iouring_epoll_w, iouring_epoll_cb, backend_fd, EV_READ); |
612 | ev_set_priority (&iouring_epoll_w, EV_MAXPRI); |
621 | ev_set_priority (&iouring_epoll_w, EV_MAXPRI); |
613 | |
622 | |
614 | ev_io_init (&iouring_tfd_w, iouring_tfd_cb, iouring_tfd, EV_READ); |
623 | ev_io_init (&iouring_tfd_w, iouring_tfd_cb, iouring_tfd, EV_READ); |
615 | ev_set_priority (&iouring_tfd_w, EV_MAXPRI); |
624 | ev_set_priority (&iouring_tfd_w, EV_MAXPRI); |
616 | |
|
|
617 | iouring_entries = IOURING_INIT_ENTRIES; |
|
|
618 | iouring_max_entries = 0; |
|
|
619 | |
|
|
620 | if (iouring_internal_init (EV_A) < 0) |
|
|
621 | { |
|
|
622 | iouring_internal_destroy (EV_A); |
|
|
623 | return 0; |
|
|
624 | } |
|
|
625 | |
625 | |
626 | ev_io_start (EV_A_ &iouring_epoll_w); |
626 | ev_io_start (EV_A_ &iouring_epoll_w); |
627 | ev_unref (EV_A); /* watcher should not keep loop alive */ |
627 | ev_unref (EV_A); /* watcher should not keep loop alive */ |
628 | |
628 | |
629 | ev_io_start (EV_A_ &iouring_tfd_w); |
629 | ev_io_start (EV_A_ &iouring_tfd_w); |