… | |
… | |
974 | inline_size void |
974 | inline_size void |
975 | fd_reify (EV_P) |
975 | fd_reify (EV_P) |
976 | { |
976 | { |
977 | int i; |
977 | int i; |
978 | |
978 | |
|
|
979 | #if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP |
|
|
980 | for (i = 0; i < fdchangecnt; ++i) |
|
|
981 | { |
|
|
982 | int fd = fdchanges [i]; |
|
|
983 | ANFD *anfd = anfds + fd; |
|
|
984 | |
|
|
985 | if (anfd->reify & EV__IOFDSET) |
|
|
986 | { |
|
|
987 | SOCKET handle = EV_FD_TO_WIN32_HANDLE (fd); |
|
|
988 | |
|
|
989 | if (handle != anfd->handle) |
|
|
990 | { |
|
|
991 | unsigned long arg; |
|
|
992 | |
|
|
993 | assert (("libev: only socket fds supported in this configuration", ioctlsocket (handle, FIONREAD, &arg) == 0)); |
|
|
994 | |
|
|
995 | /* handle changed, but fd didn't - we need to do it in two steps */ |
|
|
996 | backend_modify (EV_A_ fd, anfd->events, 0); |
|
|
997 | anfd->events = 0; |
|
|
998 | anfd->handle = handle; |
|
|
999 | } |
|
|
1000 | } |
|
|
1001 | } |
|
|
1002 | #endif |
|
|
1003 | |
979 | for (i = 0; i < fdchangecnt; ++i) |
1004 | for (i = 0; i < fdchangecnt; ++i) |
980 | { |
1005 | { |
981 | int fd = fdchanges [i]; |
1006 | int fd = fdchanges [i]; |
982 | ANFD *anfd = anfds + fd; |
1007 | ANFD *anfd = anfds + fd; |
983 | ev_io *w; |
1008 | ev_io *w; |
984 | |
1009 | |
985 | unsigned char o_events = anfd->events; |
1010 | unsigned char o_events = anfd->events; |
986 | unsigned char o_reify = anfd->reify; |
1011 | unsigned char o_reify = anfd->reify; |
987 | |
1012 | |
988 | anfd->reify = 0; |
1013 | anfd->reify = 0; |
989 | |
|
|
990 | #if EV_SELECT_IS_WINSOCKET || EV_USE_IOCP |
|
|
991 | if (o_reify & EV__IOFDSET) |
|
|
992 | { |
|
|
993 | unsigned long arg; |
|
|
994 | anfd->handle = EV_FD_TO_WIN32_HANDLE (fd); |
|
|
995 | assert (("libev: only socket fds supported in this configuration", ioctlsocket (anfd->handle, FIONREAD, &arg) == 0)); |
|
|
996 | printf ("oi %d %x\n", fd, anfd->handle);//D |
|
|
997 | } |
|
|
998 | #endif |
|
|
999 | |
1014 | |
1000 | /*if (expect_true (o_reify & EV_ANFD_REIFY)) probably a deoptimisation */ |
1015 | /*if (expect_true (o_reify & EV_ANFD_REIFY)) probably a deoptimisation */ |
1001 | { |
1016 | { |
1002 | anfd->events = 0; |
1017 | anfd->events = 0; |
1003 | |
1018 | |
… | |
… | |
2193 | } |
2208 | } |
2194 | } |
2209 | } |
2195 | |
2210 | |
2196 | #if EV_PERIODIC_ENABLE |
2211 | #if EV_PERIODIC_ENABLE |
2197 | |
2212 | |
2198 | inline_speed |
2213 | inline_speed void |
2199 | periodic_recalc (EV_P_ ev_periodic *w) |
2214 | periodic_recalc (EV_P_ ev_periodic *w) |
2200 | { |
2215 | { |
2201 | /* TODO: use slow but potentially more correct incremental algo, */ |
2216 | /* TODO: use slow but potentially more correct incremental algo, */ |
2202 | /* also do not rely on ceil */ |
2217 | /* also do not rely on ceil */ |
2203 | ev_at (w) = w->offset + ceil ((ev_rt_now - w->offset) / w->interval) * w->interval; |
2218 | ev_at (w) = w->offset + ceil ((ev_rt_now - w->offset) / w->interval) * w->interval; |