… | |
… | |
232 | base = realloc (base, sizeof (*base) * (newcnt)); \ |
232 | base = realloc (base, sizeof (*base) * (newcnt)); \ |
233 | init (base + cur, newcnt - cur); \ |
233 | init (base + cur, newcnt - cur); \ |
234 | cur = newcnt; \ |
234 | cur = newcnt; \ |
235 | } |
235 | } |
236 | |
236 | |
|
|
237 | #define array_free(stem, idx) \ |
|
|
238 | free (stem ## s idx); stem ## cnt idx = stem ## max idx = 0; |
|
|
239 | |
237 | /*****************************************************************************/ |
240 | /*****************************************************************************/ |
238 | |
241 | |
239 | static void |
242 | static void |
240 | anfds_init (ANFD *base, int count) |
243 | anfds_init (ANFD *base, int count) |
241 | { |
244 | { |
… | |
… | |
306 | for (w = (struct ev_io *)anfd->head; w; w = (struct ev_io *)((WL)w)->next) |
309 | for (w = (struct ev_io *)anfd->head; w; w = (struct ev_io *)((WL)w)->next) |
307 | events |= w->events; |
310 | events |= w->events; |
308 | |
311 | |
309 | anfd->reify = 0; |
312 | anfd->reify = 0; |
310 | |
313 | |
311 | if (anfd->events != events) |
|
|
312 | { |
|
|
313 | method_modify (EV_A_ fd, anfd->events, events); |
314 | method_modify (EV_A_ fd, anfd->events, events); |
314 | anfd->events = events; |
315 | anfd->events = events; |
315 | } |
|
|
316 | } |
316 | } |
317 | |
317 | |
318 | fdchangecnt = 0; |
318 | fdchangecnt = 0; |
319 | } |
319 | } |
320 | |
320 | |
… | |
… | |
637 | } |
637 | } |
638 | |
638 | |
639 | void |
639 | void |
640 | loop_destroy (EV_P) |
640 | loop_destroy (EV_P) |
641 | { |
641 | { |
|
|
642 | int i; |
|
|
643 | |
642 | #if EV_USE_WIN32 |
644 | #if EV_USE_WIN32 |
643 | if (method == EVMETHOD_WIN32 ) win32_destroy (EV_A); |
645 | if (method == EVMETHOD_WIN32 ) win32_destroy (EV_A); |
644 | #endif |
646 | #endif |
645 | #if EV_USE_KQUEUE |
647 | #if EV_USE_KQUEUE |
646 | if (method == EVMETHOD_KQUEUE) kqueue_destroy (EV_A); |
648 | if (method == EVMETHOD_KQUEUE) kqueue_destroy (EV_A); |
… | |
… | |
652 | if (method == EVMETHOD_POLL ) poll_destroy (EV_A); |
654 | if (method == EVMETHOD_POLL ) poll_destroy (EV_A); |
653 | #endif |
655 | #endif |
654 | #if EV_USE_SELECT |
656 | #if EV_USE_SELECT |
655 | if (method == EVMETHOD_SELECT) select_destroy (EV_A); |
657 | if (method == EVMETHOD_SELECT) select_destroy (EV_A); |
656 | #endif |
658 | #endif |
|
|
659 | |
|
|
660 | for (i = NUMPRI; i--; ) |
|
|
661 | array_free (pending, [i]); |
|
|
662 | |
|
|
663 | array_free (fdchange, ); |
|
|
664 | array_free (timer, ); |
|
|
665 | array_free (periodic, ); |
|
|
666 | array_free (idle, ); |
|
|
667 | array_free (prepare, ); |
|
|
668 | array_free (check, ); |
657 | |
669 | |
658 | method = 0; |
670 | method = 0; |
659 | /*TODO*/ |
671 | /*TODO*/ |
660 | } |
672 | } |
661 | |
673 | |
… | |
… | |
796 | ANPENDING *p = pendings [pri] + --pendingcnt [pri]; |
808 | ANPENDING *p = pendings [pri] + --pendingcnt [pri]; |
797 | |
809 | |
798 | if (p->w) |
810 | if (p->w) |
799 | { |
811 | { |
800 | p->w->pending = 0; |
812 | p->w->pending = 0; |
801 | |
|
|
802 | (*(void (**)(EV_P_ W, int))&p->w->cb) (EV_A_ p->w, p->events); |
813 | p->w->cb (EV_A_ p->w, p->events); |
803 | } |
814 | } |
804 | } |
815 | } |
805 | } |
816 | } |
806 | |
817 | |
807 | static void |
818 | static void |