… | |
… | |
51 | |
51 | |
52 | # if HAVE_EPOLL && HAVE_EPOLL_CTL && HAVE_SYS_EPOLL_H |
52 | # if HAVE_EPOLL && HAVE_EPOLL_CTL && HAVE_SYS_EPOLL_H |
53 | # define EV_USE_EPOLL 1 |
53 | # define EV_USE_EPOLL 1 |
54 | # endif |
54 | # endif |
55 | |
55 | |
56 | # if HAVE_KQUEUE && HAVE_WORKING_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H |
56 | # if HAVE_KQUEUE && HAVE_SYS_EVENT_H && HAVE_SYS_QUEUE_H |
57 | # define EV_USE_KQUEUE 1 |
57 | # define EV_USE_KQUEUE 1 |
58 | # endif |
58 | # endif |
59 | |
59 | |
60 | #endif |
60 | #endif |
61 | |
61 | |
… | |
… | |
249 | |
249 | |
250 | #endif |
250 | #endif |
251 | |
251 | |
252 | /*****************************************************************************/ |
252 | /*****************************************************************************/ |
253 | |
253 | |
254 | inline ev_tstamp |
254 | ev_tstamp |
255 | ev_time (void) |
255 | ev_time (void) |
256 | { |
256 | { |
257 | #if EV_USE_REALTIME |
257 | #if EV_USE_REALTIME |
258 | struct timespec ts; |
258 | struct timespec ts; |
259 | clock_gettime (CLOCK_REALTIME, &ts); |
259 | clock_gettime (CLOCK_REALTIME, &ts); |
… | |
… | |
987 | |
987 | |
988 | /* first reschedule or stop timer */ |
988 | /* first reschedule or stop timer */ |
989 | if (w->repeat) |
989 | if (w->repeat) |
990 | { |
990 | { |
991 | assert (("negative ev_timer repeat value found while processing timers", w->repeat > 0.)); |
991 | assert (("negative ev_timer repeat value found while processing timers", w->repeat > 0.)); |
|
|
992 | |
992 | ((WT)w)->at = mn_now + w->repeat; |
993 | ((WT)w)->at += w->repeat; |
|
|
994 | if (((WT)w)->at < mn_now) |
|
|
995 | ((WT)w)->at = mn_now; |
|
|
996 | |
993 | downheap ((WT *)timers, timercnt, 0); |
997 | downheap ((WT *)timers, timercnt, 0); |
994 | } |
998 | } |
995 | else |
999 | else |
996 | ev_timer_stop (EV_A_ w); /* nonrepeating: stop timer */ |
1000 | ev_timer_stop (EV_A_ w); /* nonrepeating: stop timer */ |
997 | |
1001 | |
… | |
… | |
1292 | { |
1296 | { |
1293 | ev_clear_pending (EV_A_ (W)w); |
1297 | ev_clear_pending (EV_A_ (W)w); |
1294 | if (!ev_is_active (w)) |
1298 | if (!ev_is_active (w)) |
1295 | return; |
1299 | return; |
1296 | |
1300 | |
|
|
1301 | assert (("ev_io_start called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax)); |
|
|
1302 | |
1297 | wlist_del ((WL *)&anfds[w->fd].head, (WL)w); |
1303 | wlist_del ((WL *)&anfds[w->fd].head, (WL)w); |
1298 | ev_stop (EV_A_ (W)w); |
1304 | ev_stop (EV_A_ (W)w); |
1299 | |
1305 | |
1300 | fd_change (EV_A_ w->fd); |
1306 | fd_change (EV_A_ w->fd); |
1301 | } |
1307 | } |
… | |
… | |
1331 | { |
1337 | { |
1332 | timers [((W)w)->active - 1] = timers [timercnt]; |
1338 | timers [((W)w)->active - 1] = timers [timercnt]; |
1333 | downheap ((WT *)timers, timercnt, ((W)w)->active - 1); |
1339 | downheap ((WT *)timers, timercnt, ((W)w)->active - 1); |
1334 | } |
1340 | } |
1335 | |
1341 | |
1336 | ((WT)w)->at = w->repeat; |
1342 | ((WT)w)->at -= mn_now; |
1337 | |
1343 | |
1338 | ev_stop (EV_A_ (W)w); |
1344 | ev_stop (EV_A_ (W)w); |
1339 | } |
1345 | } |
1340 | |
1346 | |
1341 | void |
1347 | void |