--- libev/ev_iouring.c 2019/07/09 00:04:35 1.2 +++ libev/ev_iouring.c 2019/12/20 05:20:23 1.6 @@ -363,7 +363,6 @@ static void iouring_modify (EV_P_ int fd, int oev, int nev) { - fprintf (stderr,"modify %d (%d, %d) %d\n", fd, oev,nev, anfds[fd].eflags);//D if (ecb_expect_false (anfds [fd].eflags)) { /* we handed this fd over to epoll, so undo this first */ @@ -473,8 +472,6 @@ return; } - fprintf (stderr, "fd %d event, rearm\n", fd);//D - /* feed events, we do not expect or handle POLLNVAL */ fd_event ( EV_A_ @@ -576,12 +573,12 @@ { /* if we have events, no need for extra syscalls, but we might have to queue events */ if (iouring_handle_cq (EV_A)) - timeout = 0.; + timeout = EV_TS_CONST (0.); else /* no events, so maybe wait for some */ iouring_tfd_update (EV_A_ timeout); - /* only enter the kernel if we have somethign to submit, or we need to wait */ + /* only enter the kernel if we have something to submit, or we need to wait */ if (timeout || iouring_to_submit) { int res; @@ -589,7 +586,7 @@ EV_RELEASE_CB; res = evsys_io_uring_enter (iouring_fd, iouring_to_submit, 1, - timeout ? IORING_ENTER_GETEVENTS : 0, 0, 0); + timeout > EV_TS_CONST (0.) ? IORING_ENTER_GETEVENTS : 0, 0, 0); iouring_to_submit = 0; EV_ACQUIRE_CB; @@ -611,12 +608,6 @@ if (!epoll_init (EV_A_ 0)) return 0; - ev_io_init (EV_A_ &iouring_epoll_w, iouring_epoll_cb, backend_fd, EV_READ); - ev_set_priority (&iouring_epoll_w, EV_MAXPRI); - - ev_io_init (&iouring_tfd_w, iouring_tfd_cb, iouring_tfd, EV_READ); - ev_set_priority (&iouring_tfd_w, EV_MAXPRI); - iouring_entries = IOURING_INIT_ENTRIES; iouring_max_entries = 0; @@ -626,6 +617,12 @@ return 0; } + ev_io_init (&iouring_epoll_w, iouring_epoll_cb, backend_fd, EV_READ); + ev_set_priority (&iouring_epoll_w, EV_MAXPRI); + + ev_io_init (&iouring_tfd_w, iouring_tfd_cb, iouring_tfd, EV_READ); + ev_set_priority (&iouring_tfd_w, EV_MAXPRI); + ev_io_start (EV_A_ &iouring_epoll_w); ev_unref (EV_A); /* watcher should not keep loop alive */