… | |
… | |
145 | { |
145 | { |
146 | int i; |
146 | int i; |
147 | int eventcnt; |
147 | int eventcnt; |
148 | |
148 | |
149 | if (ecb_expect_false (epoll_epermcnt)) |
149 | if (ecb_expect_false (epoll_epermcnt)) |
150 | timeout = 0.; |
150 | timeout = EV_TS_CONST (0.); |
151 | |
151 | |
152 | /* epoll wait times cannot be larger than (LONG_MAX - 999UL) / HZ msecs, which is below */ |
152 | /* epoll wait times cannot be larger than (LONG_MAX - 999UL) / HZ msecs, which is below */ |
153 | /* the default libev max wait time, however. */ |
153 | /* the default libev max wait time, however. */ |
154 | EV_RELEASE_CB; |
154 | EV_RELEASE_CB; |
155 | eventcnt = epoll_wait (backend_fd, epoll_events, epoll_eventmax, EV_TS_TO_MSEC (timeout)); |
155 | eventcnt = epoll_wait (backend_fd, epoll_events, epoll_eventmax, EV_TS_TO_MSEC (timeout)); |
… | |
… | |
264 | epoll_init (EV_P_ int flags) |
264 | epoll_init (EV_P_ int flags) |
265 | { |
265 | { |
266 | if ((backend_fd = epoll_epoll_create ()) < 0) |
266 | if ((backend_fd = epoll_epoll_create ()) < 0) |
267 | return 0; |
267 | return 0; |
268 | |
268 | |
269 | backend_mintime = 1e-3; /* epoll does sometimes return early, this is just to avoid the worst */ |
269 | backend_mintime = EV_TS_CONST (1e-3); /* epoll does sometimes return early, this is just to avoid the worst */ |
270 | backend_modify = epoll_modify; |
270 | backend_modify = epoll_modify; |
271 | backend_poll = epoll_poll; |
271 | backend_poll = epoll_poll; |
272 | |
272 | |
273 | epoll_eventmax = 64; /* initial number of events receivable per poll */ |
273 | epoll_eventmax = 64; /* initial number of events receivable per poll */ |
274 | epoll_events = (struct epoll_event *)ev_malloc (sizeof (struct epoll_event) * epoll_eventmax); |
274 | epoll_events = (struct epoll_event *)ev_malloc (sizeof (struct epoll_event) * epoll_eventmax); |