… | |
… | |
507 | } |
507 | } |
508 | |
508 | |
509 | void |
509 | void |
510 | ev_feed_fd_event (EV_P_ int fd, int revents) |
510 | ev_feed_fd_event (EV_P_ int fd, int revents) |
511 | { |
511 | { |
|
|
512 | if (fd >= 0 && fd < anfdmax) |
512 | fd_event (EV_A_ fd, revents); |
513 | fd_event (EV_A_ fd, revents); |
513 | } |
514 | } |
514 | |
515 | |
515 | void inline_size |
516 | void inline_size |
516 | fd_reify (EV_P) |
517 | fd_reify (EV_P) |
517 | { |
518 | { |
… | |
… | |
1162 | if (backend) |
1163 | if (backend) |
1163 | postfork = 1; |
1164 | postfork = 1; |
1164 | } |
1165 | } |
1165 | |
1166 | |
1166 | /*****************************************************************************/ |
1167 | /*****************************************************************************/ |
|
|
1168 | |
|
|
1169 | void |
|
|
1170 | ev_invoke (EV_P_ void *w, int revents) |
|
|
1171 | { |
|
|
1172 | EV_CB_INVOKE ((W)w, revents); |
|
|
1173 | } |
1167 | |
1174 | |
1168 | void inline_speed |
1175 | void inline_speed |
1169 | call_pending (EV_P) |
1176 | call_pending (EV_P) |
1170 | { |
1177 | { |
1171 | int pri; |
1178 | int pri; |
… | |
… | |
1523 | head = &(*head)->next; |
1530 | head = &(*head)->next; |
1524 | } |
1531 | } |
1525 | } |
1532 | } |
1526 | |
1533 | |
1527 | void inline_speed |
1534 | void inline_speed |
1528 | ev_clear_pending (EV_P_ W w) |
1535 | clear_pending (EV_P_ W w) |
1529 | { |
1536 | { |
1530 | if (w->pending) |
1537 | if (w->pending) |
1531 | { |
1538 | { |
1532 | pendings [ABSPRI (w)][w->pending - 1].w = 0; |
1539 | pendings [ABSPRI (w)][w->pending - 1].w = 0; |
1533 | w->pending = 0; |
1540 | w->pending = 0; |
1534 | } |
1541 | } |
|
|
1542 | } |
|
|
1543 | |
|
|
1544 | int |
|
|
1545 | ev_clear_pending (EV_P_ void *w) |
|
|
1546 | { |
|
|
1547 | W w_ = (W)w; |
|
|
1548 | int pending = w_->pending; |
|
|
1549 | |
|
|
1550 | if (!pending) |
|
|
1551 | return 0; |
|
|
1552 | |
|
|
1553 | w_->pending = 0; |
|
|
1554 | ANPENDING *p = pendings [ABSPRI (w_)] + pending - 1; |
|
|
1555 | p->w = 0; |
|
|
1556 | |
|
|
1557 | return p->events; |
1535 | } |
1558 | } |
1536 | |
1559 | |
1537 | void inline_size |
1560 | void inline_size |
1538 | pri_adjust (EV_P_ W w) |
1561 | pri_adjust (EV_P_ W w) |
1539 | { |
1562 | { |
… | |
… | |
1578 | } |
1601 | } |
1579 | |
1602 | |
1580 | void |
1603 | void |
1581 | ev_io_stop (EV_P_ ev_io *w) |
1604 | ev_io_stop (EV_P_ ev_io *w) |
1582 | { |
1605 | { |
1583 | ev_clear_pending (EV_A_ (W)w); |
1606 | clear_pending (EV_A_ (W)w); |
1584 | if (expect_false (!ev_is_active (w))) |
1607 | if (expect_false (!ev_is_active (w))) |
1585 | return; |
1608 | return; |
1586 | |
1609 | |
1587 | assert (("ev_io_start called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax)); |
1610 | assert (("ev_io_start called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax)); |
1588 | |
1611 | |
… | |
… | |
1611 | } |
1634 | } |
1612 | |
1635 | |
1613 | void |
1636 | void |
1614 | ev_timer_stop (EV_P_ ev_timer *w) |
1637 | ev_timer_stop (EV_P_ ev_timer *w) |
1615 | { |
1638 | { |
1616 | ev_clear_pending (EV_A_ (W)w); |
1639 | clear_pending (EV_A_ (W)w); |
1617 | if (expect_false (!ev_is_active (w))) |
1640 | if (expect_false (!ev_is_active (w))) |
1618 | return; |
1641 | return; |
1619 | |
1642 | |
1620 | assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w)); |
1643 | assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w)); |
1621 | |
1644 | |
… | |
… | |
1679 | } |
1702 | } |
1680 | |
1703 | |
1681 | void |
1704 | void |
1682 | ev_periodic_stop (EV_P_ ev_periodic *w) |
1705 | ev_periodic_stop (EV_P_ ev_periodic *w) |
1683 | { |
1706 | { |
1684 | ev_clear_pending (EV_A_ (W)w); |
1707 | clear_pending (EV_A_ (W)w); |
1685 | if (expect_false (!ev_is_active (w))) |
1708 | if (expect_false (!ev_is_active (w))) |
1686 | return; |
1709 | return; |
1687 | |
1710 | |
1688 | assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w)); |
1711 | assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w)); |
1689 | |
1712 | |
… | |
… | |
1743 | } |
1766 | } |
1744 | |
1767 | |
1745 | void |
1768 | void |
1746 | ev_signal_stop (EV_P_ ev_signal *w) |
1769 | ev_signal_stop (EV_P_ ev_signal *w) |
1747 | { |
1770 | { |
1748 | ev_clear_pending (EV_A_ (W)w); |
1771 | clear_pending (EV_A_ (W)w); |
1749 | if (expect_false (!ev_is_active (w))) |
1772 | if (expect_false (!ev_is_active (w))) |
1750 | return; |
1773 | return; |
1751 | |
1774 | |
1752 | wlist_del ((WL *)&signals [w->signum - 1].head, (WL)w); |
1775 | wlist_del ((WL *)&signals [w->signum - 1].head, (WL)w); |
1753 | ev_stop (EV_A_ (W)w); |
1776 | ev_stop (EV_A_ (W)w); |
… | |
… | |
1770 | } |
1793 | } |
1771 | |
1794 | |
1772 | void |
1795 | void |
1773 | ev_child_stop (EV_P_ ev_child *w) |
1796 | ev_child_stop (EV_P_ ev_child *w) |
1774 | { |
1797 | { |
1775 | ev_clear_pending (EV_A_ (W)w); |
1798 | clear_pending (EV_A_ (W)w); |
1776 | if (expect_false (!ev_is_active (w))) |
1799 | if (expect_false (!ev_is_active (w))) |
1777 | return; |
1800 | return; |
1778 | |
1801 | |
1779 | wlist_del ((WL *)&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w); |
1802 | wlist_del ((WL *)&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w); |
1780 | ev_stop (EV_A_ (W)w); |
1803 | ev_stop (EV_A_ (W)w); |
… | |
… | |
2016 | } |
2039 | } |
2017 | |
2040 | |
2018 | void |
2041 | void |
2019 | ev_stat_stop (EV_P_ ev_stat *w) |
2042 | ev_stat_stop (EV_P_ ev_stat *w) |
2020 | { |
2043 | { |
2021 | ev_clear_pending (EV_A_ (W)w); |
2044 | clear_pending (EV_A_ (W)w); |
2022 | if (expect_false (!ev_is_active (w))) |
2045 | if (expect_false (!ev_is_active (w))) |
2023 | return; |
2046 | return; |
2024 | |
2047 | |
2025 | #if EV_USE_INOTIFY |
2048 | #if EV_USE_INOTIFY |
2026 | infy_del (EV_A_ w); |
2049 | infy_del (EV_A_ w); |
… | |
… | |
2052 | } |
2075 | } |
2053 | |
2076 | |
2054 | void |
2077 | void |
2055 | ev_idle_stop (EV_P_ ev_idle *w) |
2078 | ev_idle_stop (EV_P_ ev_idle *w) |
2056 | { |
2079 | { |
2057 | ev_clear_pending (EV_A_ (W)w); |
2080 | clear_pending (EV_A_ (W)w); |
2058 | if (expect_false (!ev_is_active (w))) |
2081 | if (expect_false (!ev_is_active (w))) |
2059 | return; |
2082 | return; |
2060 | |
2083 | |
2061 | { |
2084 | { |
2062 | int active = ((W)w)->active; |
2085 | int active = ((W)w)->active; |
… | |
… | |
2082 | } |
2105 | } |
2083 | |
2106 | |
2084 | void |
2107 | void |
2085 | ev_prepare_stop (EV_P_ ev_prepare *w) |
2108 | ev_prepare_stop (EV_P_ ev_prepare *w) |
2086 | { |
2109 | { |
2087 | ev_clear_pending (EV_A_ (W)w); |
2110 | clear_pending (EV_A_ (W)w); |
2088 | if (expect_false (!ev_is_active (w))) |
2111 | if (expect_false (!ev_is_active (w))) |
2089 | return; |
2112 | return; |
2090 | |
2113 | |
2091 | { |
2114 | { |
2092 | int active = ((W)w)->active; |
2115 | int active = ((W)w)->active; |
… | |
… | |
2109 | } |
2132 | } |
2110 | |
2133 | |
2111 | void |
2134 | void |
2112 | ev_check_stop (EV_P_ ev_check *w) |
2135 | ev_check_stop (EV_P_ ev_check *w) |
2113 | { |
2136 | { |
2114 | ev_clear_pending (EV_A_ (W)w); |
2137 | clear_pending (EV_A_ (W)w); |
2115 | if (expect_false (!ev_is_active (w))) |
2138 | if (expect_false (!ev_is_active (w))) |
2116 | return; |
2139 | return; |
2117 | |
2140 | |
2118 | { |
2141 | { |
2119 | int active = ((W)w)->active; |
2142 | int active = ((W)w)->active; |
… | |
… | |
2161 | } |
2184 | } |
2162 | |
2185 | |
2163 | void |
2186 | void |
2164 | ev_embed_stop (EV_P_ ev_embed *w) |
2187 | ev_embed_stop (EV_P_ ev_embed *w) |
2165 | { |
2188 | { |
2166 | ev_clear_pending (EV_A_ (W)w); |
2189 | clear_pending (EV_A_ (W)w); |
2167 | if (expect_false (!ev_is_active (w))) |
2190 | if (expect_false (!ev_is_active (w))) |
2168 | return; |
2191 | return; |
2169 | |
2192 | |
2170 | ev_io_stop (EV_A_ &w->io); |
2193 | ev_io_stop (EV_A_ &w->io); |
2171 | |
2194 | |
… | |
… | |
2186 | } |
2209 | } |
2187 | |
2210 | |
2188 | void |
2211 | void |
2189 | ev_fork_stop (EV_P_ ev_fork *w) |
2212 | ev_fork_stop (EV_P_ ev_fork *w) |
2190 | { |
2213 | { |
2191 | ev_clear_pending (EV_A_ (W)w); |
2214 | clear_pending (EV_A_ (W)w); |
2192 | if (expect_false (!ev_is_active (w))) |
2215 | if (expect_false (!ev_is_active (w))) |
2193 | return; |
2216 | return; |
2194 | |
2217 | |
2195 | { |
2218 | { |
2196 | int active = ((W)w)->active; |
2219 | int active = ((W)w)->active; |