… | |
… | |
792 | ev_unref (EV_A); /* child watcher should not keep loop alive */ |
792 | ev_unref (EV_A); /* child watcher should not keep loop alive */ |
793 | } |
793 | } |
794 | |
794 | |
795 | /*****************************************************************************/ |
795 | /*****************************************************************************/ |
796 | |
796 | |
797 | static ev_child *childs [EV_PID_HASHSIZE]; |
797 | static WL childs [EV_PID_HASHSIZE]; |
798 | |
798 | |
799 | #ifndef _WIN32 |
799 | #ifndef _WIN32 |
800 | |
800 | |
801 | static ev_signal childev; |
801 | static ev_signal childev; |
802 | |
802 | |
… | |
… | |
1597 | |
1597 | |
1598 | assert (("ev_io_start called with negative fd", fd >= 0)); |
1598 | assert (("ev_io_start called with negative fd", fd >= 0)); |
1599 | |
1599 | |
1600 | ev_start (EV_A_ (W)w, 1); |
1600 | ev_start (EV_A_ (W)w, 1); |
1601 | array_needsize (ANFD, anfds, anfdmax, fd + 1, anfds_init); |
1601 | array_needsize (ANFD, anfds, anfdmax, fd + 1, anfds_init); |
1602 | wlist_add ((WL *)&anfds[fd].head, (WL)w); |
1602 | wlist_add (&anfds[fd].head, (WL)w); |
1603 | |
1603 | |
1604 | fd_change (EV_A_ fd); |
1604 | fd_change (EV_A_ fd); |
1605 | } |
1605 | } |
1606 | |
1606 | |
1607 | void noinline |
1607 | void noinline |
… | |
… | |
1611 | if (expect_false (!ev_is_active (w))) |
1611 | if (expect_false (!ev_is_active (w))) |
1612 | return; |
1612 | return; |
1613 | |
1613 | |
1614 | assert (("ev_io_start called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax)); |
1614 | assert (("ev_io_start called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax)); |
1615 | |
1615 | |
1616 | wlist_del ((WL *)&anfds[w->fd].head, (WL)w); |
1616 | wlist_del (&anfds[w->fd].head, (WL)w); |
1617 | ev_stop (EV_A_ (W)w); |
1617 | ev_stop (EV_A_ (W)w); |
1618 | |
1618 | |
1619 | fd_change (EV_A_ w->fd); |
1619 | fd_change (EV_A_ w->fd); |
1620 | } |
1620 | } |
1621 | |
1621 | |
… | |
… | |
1766 | sigprocmask (SIG_SETMASK, &prev, 0); |
1766 | sigprocmask (SIG_SETMASK, &prev, 0); |
1767 | #endif |
1767 | #endif |
1768 | } |
1768 | } |
1769 | |
1769 | |
1770 | ev_start (EV_A_ (W)w, 1); |
1770 | ev_start (EV_A_ (W)w, 1); |
1771 | wlist_add ((WL *)&signals [w->signum - 1].head, (WL)w); |
1771 | wlist_add (&signals [w->signum - 1].head, (WL)w); |
1772 | |
1772 | |
1773 | if (!((WL)w)->next) |
1773 | if (!((WL)w)->next) |
1774 | { |
1774 | { |
1775 | #if _WIN32 |
1775 | #if _WIN32 |
1776 | signal (w->signum, sighandler); |
1776 | signal (w->signum, sighandler); |
… | |
… | |
1789 | { |
1789 | { |
1790 | clear_pending (EV_A_ (W)w); |
1790 | clear_pending (EV_A_ (W)w); |
1791 | if (expect_false (!ev_is_active (w))) |
1791 | if (expect_false (!ev_is_active (w))) |
1792 | return; |
1792 | return; |
1793 | |
1793 | |
1794 | wlist_del ((WL *)&signals [w->signum - 1].head, (WL)w); |
1794 | wlist_del (&signals [w->signum - 1].head, (WL)w); |
1795 | ev_stop (EV_A_ (W)w); |
1795 | ev_stop (EV_A_ (W)w); |
1796 | |
1796 | |
1797 | if (!signals [w->signum - 1].head) |
1797 | if (!signals [w->signum - 1].head) |
1798 | signal (w->signum, SIG_DFL); |
1798 | signal (w->signum, SIG_DFL); |
1799 | } |
1799 | } |
… | |
… | |
1806 | #endif |
1806 | #endif |
1807 | if (expect_false (ev_is_active (w))) |
1807 | if (expect_false (ev_is_active (w))) |
1808 | return; |
1808 | return; |
1809 | |
1809 | |
1810 | ev_start (EV_A_ (W)w, 1); |
1810 | ev_start (EV_A_ (W)w, 1); |
1811 | wlist_add ((WL *)&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w); |
1811 | wlist_add (&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w); |
1812 | } |
1812 | } |
1813 | |
1813 | |
1814 | void |
1814 | void |
1815 | ev_child_stop (EV_P_ ev_child *w) |
1815 | ev_child_stop (EV_P_ ev_child *w) |
1816 | { |
1816 | { |
1817 | clear_pending (EV_A_ (W)w); |
1817 | clear_pending (EV_A_ (W)w); |
1818 | if (expect_false (!ev_is_active (w))) |
1818 | if (expect_false (!ev_is_active (w))) |
1819 | return; |
1819 | return; |
1820 | |
1820 | |
1821 | wlist_del ((WL *)&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w); |
1821 | wlist_del (&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w); |
1822 | ev_stop (EV_A_ (W)w); |
1822 | ev_stop (EV_A_ (W)w); |
1823 | } |
1823 | } |
1824 | |
1824 | |
1825 | #if EV_STAT_ENABLE |
1825 | #if EV_STAT_ENABLE |
1826 | |
1826 | |