… | |
… | |
1736 | void |
1736 | void |
1737 | ev_loop_destroy (EV_P) |
1737 | ev_loop_destroy (EV_P) |
1738 | { |
1738 | { |
1739 | int i; |
1739 | int i; |
1740 | |
1740 | |
|
|
1741 | #if EV_CLEANUP_ENABLE |
|
|
1742 | /* queue cleanup watchers (and execute them) */ |
|
|
1743 | if (expect_false (cleanupcnt)) |
|
|
1744 | { |
|
|
1745 | queue_events (EV_A_ (W *)cleanups, cleanupcnt, EV_CLEANUP); |
|
|
1746 | EV_INVOKE_PENDING; |
|
|
1747 | } |
|
|
1748 | #endif |
|
|
1749 | |
1741 | #if EV_CHILD_ENABLE |
1750 | #if EV_CHILD_ENABLE |
1742 | if (ev_is_active (&childev)) |
1751 | if (ev_is_active (&childev)) |
1743 | { |
1752 | { |
1744 | ev_ref (EV_A); /* child watcher */ |
1753 | ev_ref (EV_A); /* child watcher */ |
1745 | ev_signal_stop (EV_A_ &childev); |
1754 | ev_signal_stop (EV_A_ &childev); |
… | |
… | |
3583 | |
3592 | |
3584 | ev_start (EV_A_ (W)w, ++cleanupcnt); |
3593 | ev_start (EV_A_ (W)w, ++cleanupcnt); |
3585 | array_needsize (ev_cleanup *, cleanups, cleanupmax, cleanupcnt, EMPTY2); |
3594 | array_needsize (ev_cleanup *, cleanups, cleanupmax, cleanupcnt, EMPTY2); |
3586 | cleanups [cleanupcnt - 1] = w; |
3595 | cleanups [cleanupcnt - 1] = w; |
3587 | |
3596 | |
|
|
3597 | /* cleanup watchers should never keep a refcount on the loop */ |
|
|
3598 | ev_unref (EV_A); |
3588 | EV_FREQUENT_CHECK; |
3599 | EV_FREQUENT_CHECK; |
3589 | } |
3600 | } |
3590 | |
3601 | |
3591 | void |
3602 | void |
3592 | ev_cleanup_stop (EV_P_ ev_cleanup *w) |
3603 | ev_cleanup_stop (EV_P_ ev_cleanup *w) |
… | |
… | |
3594 | clear_pending (EV_A_ (W)w); |
3605 | clear_pending (EV_A_ (W)w); |
3595 | if (expect_false (!ev_is_active (w))) |
3606 | if (expect_false (!ev_is_active (w))) |
3596 | return; |
3607 | return; |
3597 | |
3608 | |
3598 | EV_FREQUENT_CHECK; |
3609 | EV_FREQUENT_CHECK; |
|
|
3610 | ev_ref (EV_A); |
3599 | |
3611 | |
3600 | { |
3612 | { |
3601 | int active = ev_active (w); |
3613 | int active = ev_active (w); |
3602 | |
3614 | |
3603 | cleanups [active - 1] = cleanups [--cleanupcnt]; |
3615 | cleanups [active - 1] = cleanups [--cleanupcnt]; |