… | |
… | |
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); |
… | |
… | |
1812 | #if EV_PERIODIC_ENABLE |
1821 | #if EV_PERIODIC_ENABLE |
1813 | array_free (periodic, EMPTY); |
1822 | array_free (periodic, EMPTY); |
1814 | #endif |
1823 | #endif |
1815 | #if EV_FORK_ENABLE |
1824 | #if EV_FORK_ENABLE |
1816 | array_free (fork, EMPTY); |
1825 | array_free (fork, EMPTY); |
|
|
1826 | #endif |
|
|
1827 | #if EV_CLEANUP_ENABLE |
|
|
1828 | array_free (cleanup, EMPTY); |
1817 | #endif |
1829 | #endif |
1818 | array_free (prepare, EMPTY); |
1830 | array_free (prepare, EMPTY); |
1819 | array_free (check, EMPTY); |
1831 | array_free (check, EMPTY); |
1820 | #if EV_ASYNC_ENABLE |
1832 | #if EV_ASYNC_ENABLE |
1821 | array_free (async, EMPTY); |
1833 | array_free (async, EMPTY); |
… | |
… | |
1983 | } |
1995 | } |
1984 | |
1996 | |
1985 | #if EV_FORK_ENABLE |
1997 | #if EV_FORK_ENABLE |
1986 | assert (forkmax >= forkcnt); |
1998 | assert (forkmax >= forkcnt); |
1987 | array_verify (EV_A_ (W *)forks, forkcnt); |
1999 | array_verify (EV_A_ (W *)forks, forkcnt); |
|
|
2000 | #endif |
|
|
2001 | |
|
|
2002 | #if EV_CLEANUP_ENABLE |
|
|
2003 | assert (cleanupmax >= cleanupcnt); |
|
|
2004 | array_verify (EV_A_ (W *)cleanups, cleanupcnt); |
1988 | #endif |
2005 | #endif |
1989 | |
2006 | |
1990 | #if EV_ASYNC_ENABLE |
2007 | #if EV_ASYNC_ENABLE |
1991 | assert (asyncmax >= asynccnt); |
2008 | assert (asyncmax >= asynccnt); |
1992 | array_verify (EV_A_ (W *)asyncs, asynccnt); |
2009 | array_verify (EV_A_ (W *)asyncs, asynccnt); |
… | |
… | |
3562 | |
3579 | |
3563 | EV_FREQUENT_CHECK; |
3580 | EV_FREQUENT_CHECK; |
3564 | } |
3581 | } |
3565 | #endif |
3582 | #endif |
3566 | |
3583 | |
|
|
3584 | #if EV_CLEANUP_ENABLE |
|
|
3585 | void |
|
|
3586 | ev_cleanup_start (EV_P_ ev_cleanup *w) |
|
|
3587 | { |
|
|
3588 | if (expect_false (ev_is_active (w))) |
|
|
3589 | return; |
|
|
3590 | |
|
|
3591 | EV_FREQUENT_CHECK; |
|
|
3592 | |
|
|
3593 | ev_start (EV_A_ (W)w, ++cleanupcnt); |
|
|
3594 | array_needsize (ev_cleanup *, cleanups, cleanupmax, cleanupcnt, EMPTY2); |
|
|
3595 | cleanups [cleanupcnt - 1] = w; |
|
|
3596 | |
|
|
3597 | /* cleanup watchers should never keep a refcount on the loop */ |
|
|
3598 | ev_unref (EV_A); |
|
|
3599 | EV_FREQUENT_CHECK; |
|
|
3600 | } |
|
|
3601 | |
|
|
3602 | void |
|
|
3603 | ev_cleanup_stop (EV_P_ ev_cleanup *w) |
|
|
3604 | { |
|
|
3605 | clear_pending (EV_A_ (W)w); |
|
|
3606 | if (expect_false (!ev_is_active (w))) |
|
|
3607 | return; |
|
|
3608 | |
|
|
3609 | EV_FREQUENT_CHECK; |
|
|
3610 | ev_ref (EV_A); |
|
|
3611 | |
|
|
3612 | { |
|
|
3613 | int active = ev_active (w); |
|
|
3614 | |
|
|
3615 | cleanups [active - 1] = cleanups [--cleanupcnt]; |
|
|
3616 | ev_active (cleanups [active - 1]) = active; |
|
|
3617 | } |
|
|
3618 | |
|
|
3619 | ev_stop (EV_A_ (W)w); |
|
|
3620 | |
|
|
3621 | EV_FREQUENT_CHECK; |
|
|
3622 | } |
|
|
3623 | #endif |
|
|
3624 | |
3567 | #if EV_ASYNC_ENABLE |
3625 | #if EV_ASYNC_ENABLE |
3568 | void |
3626 | void |
3569 | ev_async_start (EV_P_ ev_async *w) |
3627 | ev_async_start (EV_P_ ev_async *w) |
3570 | { |
3628 | { |
3571 | if (expect_false (ev_is_active (w))) |
3629 | if (expect_false (ev_is_active (w))) |