ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.c
(Generate patch)

Comparing libev/ev.c (file contents):
Revision 1.164 by root, Fri Dec 7 16:44:10 2007 UTC vs.
Revision 1.167 by root, Sat Dec 8 04:02:31 2007 UTC

1266 1266
1267#if EV_IDLE_ENABLE 1267#if EV_IDLE_ENABLE
1268void inline_size 1268void inline_size
1269idle_reify (EV_P) 1269idle_reify (EV_P)
1270{ 1270{
1271 if (expect_false (!idleall)) 1271 if (expect_false (idleall))
1272 { 1272 {
1273 int pri; 1273 int pri;
1274 1274
1275 for (pri = NUMPRI; pri--; ) 1275 for (pri = NUMPRI; pri--; )
1276 { 1276 {
1523 head = &(*head)->next; 1523 head = &(*head)->next;
1524 } 1524 }
1525} 1525}
1526 1526
1527void inline_speed 1527void inline_speed
1528ev_clear_pending (EV_P_ W w) 1528clear_pending (EV_P_ W w)
1529{ 1529{
1530 if (w->pending) 1530 if (w->pending)
1531 { 1531 {
1532 pendings [ABSPRI (w)][w->pending - 1].w = 0; 1532 pendings [ABSPRI (w)][w->pending - 1].w = 0;
1533 w->pending = 0; 1533 w->pending = 0;
1534 } 1534 }
1535}
1536
1537int
1538ev_clear_pending (EV_P_ void *w)
1539{
1540 W w_ = (W)w;
1541 int pending = w_->pending;
1542
1543 if (!pending)
1544 return 0;
1545
1546 w_->pending = 0;
1547 ANPENDING *p = pendings [ABSPRI (w_)] + pending - 1;
1548 p->w = 0;
1549
1550 return p->events;
1535} 1551}
1536 1552
1537void inline_size 1553void inline_size
1538pri_adjust (EV_P_ W w) 1554pri_adjust (EV_P_ W w)
1539{ 1555{
1578} 1594}
1579 1595
1580void 1596void
1581ev_io_stop (EV_P_ ev_io *w) 1597ev_io_stop (EV_P_ ev_io *w)
1582{ 1598{
1583 ev_clear_pending (EV_A_ (W)w); 1599 clear_pending (EV_A_ (W)w);
1584 if (expect_false (!ev_is_active (w))) 1600 if (expect_false (!ev_is_active (w)))
1585 return; 1601 return;
1586 1602
1587 assert (("ev_io_start called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax)); 1603 assert (("ev_io_start called with illegal fd (must stay constant after start!)", w->fd >= 0 && w->fd < anfdmax));
1588 1604
1611} 1627}
1612 1628
1613void 1629void
1614ev_timer_stop (EV_P_ ev_timer *w) 1630ev_timer_stop (EV_P_ ev_timer *w)
1615{ 1631{
1616 ev_clear_pending (EV_A_ (W)w); 1632 clear_pending (EV_A_ (W)w);
1617 if (expect_false (!ev_is_active (w))) 1633 if (expect_false (!ev_is_active (w)))
1618 return; 1634 return;
1619 1635
1620 assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w)); 1636 assert (("internal timer heap corruption", timers [((W)w)->active - 1] == w));
1621 1637
1679} 1695}
1680 1696
1681void 1697void
1682ev_periodic_stop (EV_P_ ev_periodic *w) 1698ev_periodic_stop (EV_P_ ev_periodic *w)
1683{ 1699{
1684 ev_clear_pending (EV_A_ (W)w); 1700 clear_pending (EV_A_ (W)w);
1685 if (expect_false (!ev_is_active (w))) 1701 if (expect_false (!ev_is_active (w)))
1686 return; 1702 return;
1687 1703
1688 assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w)); 1704 assert (("internal periodic heap corruption", periodics [((W)w)->active - 1] == w));
1689 1705
1743} 1759}
1744 1760
1745void 1761void
1746ev_signal_stop (EV_P_ ev_signal *w) 1762ev_signal_stop (EV_P_ ev_signal *w)
1747{ 1763{
1748 ev_clear_pending (EV_A_ (W)w); 1764 clear_pending (EV_A_ (W)w);
1749 if (expect_false (!ev_is_active (w))) 1765 if (expect_false (!ev_is_active (w)))
1750 return; 1766 return;
1751 1767
1752 wlist_del ((WL *)&signals [w->signum - 1].head, (WL)w); 1768 wlist_del ((WL *)&signals [w->signum - 1].head, (WL)w);
1753 ev_stop (EV_A_ (W)w); 1769 ev_stop (EV_A_ (W)w);
1770} 1786}
1771 1787
1772void 1788void
1773ev_child_stop (EV_P_ ev_child *w) 1789ev_child_stop (EV_P_ ev_child *w)
1774{ 1790{
1775 ev_clear_pending (EV_A_ (W)w); 1791 clear_pending (EV_A_ (W)w);
1776 if (expect_false (!ev_is_active (w))) 1792 if (expect_false (!ev_is_active (w)))
1777 return; 1793 return;
1778 1794
1779 wlist_del ((WL *)&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w); 1795 wlist_del ((WL *)&childs [w->pid & (EV_PID_HASHSIZE - 1)], (WL)w);
1780 ev_stop (EV_A_ (W)w); 1796 ev_stop (EV_A_ (W)w);
2016} 2032}
2017 2033
2018void 2034void
2019ev_stat_stop (EV_P_ ev_stat *w) 2035ev_stat_stop (EV_P_ ev_stat *w)
2020{ 2036{
2021 ev_clear_pending (EV_A_ (W)w); 2037 clear_pending (EV_A_ (W)w);
2022 if (expect_false (!ev_is_active (w))) 2038 if (expect_false (!ev_is_active (w)))
2023 return; 2039 return;
2024 2040
2025#if EV_USE_INOTIFY 2041#if EV_USE_INOTIFY
2026 infy_del (EV_A_ w); 2042 infy_del (EV_A_ w);
2052} 2068}
2053 2069
2054void 2070void
2055ev_idle_stop (EV_P_ ev_idle *w) 2071ev_idle_stop (EV_P_ ev_idle *w)
2056{ 2072{
2057 ev_clear_pending (EV_A_ (W)w); 2073 clear_pending (EV_A_ (W)w);
2058 if (expect_false (!ev_is_active (w))) 2074 if (expect_false (!ev_is_active (w)))
2059 return; 2075 return;
2060 2076
2061 { 2077 {
2062 int active = ((W)w)->active; 2078 int active = ((W)w)->active;
2082} 2098}
2083 2099
2084void 2100void
2085ev_prepare_stop (EV_P_ ev_prepare *w) 2101ev_prepare_stop (EV_P_ ev_prepare *w)
2086{ 2102{
2087 ev_clear_pending (EV_A_ (W)w); 2103 clear_pending (EV_A_ (W)w);
2088 if (expect_false (!ev_is_active (w))) 2104 if (expect_false (!ev_is_active (w)))
2089 return; 2105 return;
2090 2106
2091 { 2107 {
2092 int active = ((W)w)->active; 2108 int active = ((W)w)->active;
2109} 2125}
2110 2126
2111void 2127void
2112ev_check_stop (EV_P_ ev_check *w) 2128ev_check_stop (EV_P_ ev_check *w)
2113{ 2129{
2114 ev_clear_pending (EV_A_ (W)w); 2130 clear_pending (EV_A_ (W)w);
2115 if (expect_false (!ev_is_active (w))) 2131 if (expect_false (!ev_is_active (w)))
2116 return; 2132 return;
2117 2133
2118 { 2134 {
2119 int active = ((W)w)->active; 2135 int active = ((W)w)->active;
2161} 2177}
2162 2178
2163void 2179void
2164ev_embed_stop (EV_P_ ev_embed *w) 2180ev_embed_stop (EV_P_ ev_embed *w)
2165{ 2181{
2166 ev_clear_pending (EV_A_ (W)w); 2182 clear_pending (EV_A_ (W)w);
2167 if (expect_false (!ev_is_active (w))) 2183 if (expect_false (!ev_is_active (w)))
2168 return; 2184 return;
2169 2185
2170 ev_io_stop (EV_A_ &w->io); 2186 ev_io_stop (EV_A_ &w->io);
2171 2187
2186} 2202}
2187 2203
2188void 2204void
2189ev_fork_stop (EV_P_ ev_fork *w) 2205ev_fork_stop (EV_P_ ev_fork *w)
2190{ 2206{
2191 ev_clear_pending (EV_A_ (W)w); 2207 clear_pending (EV_A_ (W)w);
2192 if (expect_false (!ev_is_active (w))) 2208 if (expect_false (!ev_is_active (w)))
2193 return; 2209 return;
2194 2210
2195 { 2211 {
2196 int active = ((W)w)->active; 2212 int active = ((W)w)->active;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines