- for (i = 0; i < eventcnt; ++i)
- event (events [i], type);
+ for (i = 0; i < fdchangecnt; ++i)
+ {
+ int fd = fdchanges [i];
+ ANFD *anfd = anfds + fd;
+ struct ev_io *w;
+
+ int events = 0;
+
+ for (w = anfd->head; w; w = w->next)
+ events |= w->events;
+
+ anfd->reify = 0;
+
+ if (anfd->events != events)
+ {
+ method_modify (fd, anfd->events, events);
+ anfd->events = events;
+ }
+ }
+
+ fdchangecnt = 0;
+}
+
+static void
+fd_change (int fd)
+{
+ if (anfds [fd].reify || fdchangecnt < 0)
+ return;
+
+ anfds [fd].reify = 1;
+
+ ++fdchangecnt;
+ array_needsize (fdchanges, fdchangemax, fdchangecnt, );
+ fdchanges [fdchangecnt - 1] = fd;