… | |
… | |
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 | { |
… | |
… | |
634 | } |
637 | } |
635 | |
638 | |
636 | void |
639 | void |
637 | loop_destroy (EV_P) |
640 | loop_destroy (EV_P) |
638 | { |
641 | { |
|
|
642 | int i; |
|
|
643 | |
639 | #if EV_USE_WIN32 |
644 | #if EV_USE_WIN32 |
640 | if (method == EVMETHOD_WIN32 ) win32_destroy (EV_A); |
645 | if (method == EVMETHOD_WIN32 ) win32_destroy (EV_A); |
641 | #endif |
646 | #endif |
642 | #if EV_USE_KQUEUE |
647 | #if EV_USE_KQUEUE |
643 | if (method == EVMETHOD_KQUEUE) kqueue_destroy (EV_A); |
648 | if (method == EVMETHOD_KQUEUE) kqueue_destroy (EV_A); |
… | |
… | |
649 | if (method == EVMETHOD_POLL ) poll_destroy (EV_A); |
654 | if (method == EVMETHOD_POLL ) poll_destroy (EV_A); |
650 | #endif |
655 | #endif |
651 | #if EV_USE_SELECT |
656 | #if EV_USE_SELECT |
652 | if (method == EVMETHOD_SELECT) select_destroy (EV_A); |
657 | if (method == EVMETHOD_SELECT) select_destroy (EV_A); |
653 | #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, ); |
654 | |
669 | |
655 | method = 0; |
670 | method = 0; |
656 | /*TODO*/ |
671 | /*TODO*/ |
657 | } |
672 | } |
658 | |
673 | |
… | |
… | |
794 | |
809 | |
795 | if (p->w) |
810 | if (p->w) |
796 | { |
811 | { |
797 | p->w->pending = 0; |
812 | p->w->pending = 0; |
798 | |
813 | |
799 | (*(void (**)(EV_P_ W, int))&p->w->cb) (EV_A_ p->w, p->events); |
814 | ((void (*)(EV_P_ W, int))p->w->cb) (EV_A_ p->w, p->events); |
800 | } |
815 | } |
801 | } |
816 | } |
802 | } |
817 | } |
803 | |
818 | |
804 | static void |
819 | static void |