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.168 by root, Sat Dec 8 14:12:07 2007 UTC

507} 507}
508 508
509void 509void
510ev_feed_fd_event (EV_P_ int fd, int revents) 510ev_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
515void inline_size 516void inline_size
516fd_reify (EV_P) 517fd_reify (EV_P)
517{ 518{
1162 if (backend) 1163 if (backend)
1163 postfork = 1; 1164 postfork = 1;
1164} 1165}
1165 1166
1166/*****************************************************************************/ 1167/*****************************************************************************/
1168
1169void
1170ev_invoke (EV_P_ void *w, int revents)
1171{
1172 EV_CB_INVOKE ((W)w, revents);
1173}
1167 1174
1168void inline_speed 1175void inline_speed
1169call_pending (EV_P) 1176call_pending (EV_P)
1170{ 1177{
1171 int pri; 1178 int pri;
1266 1273
1267#if EV_IDLE_ENABLE 1274#if EV_IDLE_ENABLE
1268void inline_size 1275void inline_size
1269idle_reify (EV_P) 1276idle_reify (EV_P)
1270{ 1277{
1271 if (expect_false (!idleall)) 1278 if (expect_false (idleall))
1272 { 1279 {
1273 int pri; 1280 int pri;
1274 1281
1275 for (pri = NUMPRI; pri--; ) 1282 for (pri = NUMPRI; pri--; )
1276 { 1283 {
1523 head = &(*head)->next; 1530 head = &(*head)->next;
1524 } 1531 }
1525} 1532}
1526 1533
1527void inline_speed 1534void inline_speed
1528ev_clear_pending (EV_P_ W w) 1535clear_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
1544int
1545ev_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
1537void inline_size 1560void inline_size
1538pri_adjust (EV_P_ W w) 1561pri_adjust (EV_P_ W w)
1539{ 1562{
1578} 1601}
1579 1602
1580void 1603void
1581ev_io_stop (EV_P_ ev_io *w) 1604ev_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
1613void 1636void
1614ev_timer_stop (EV_P_ ev_timer *w) 1637ev_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
1681void 1704void
1682ev_periodic_stop (EV_P_ ev_periodic *w) 1705ev_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
1745void 1768void
1746ev_signal_stop (EV_P_ ev_signal *w) 1769ev_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
1772void 1795void
1773ev_child_stop (EV_P_ ev_child *w) 1796ev_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
2018void 2041void
2019ev_stat_stop (EV_P_ ev_stat *w) 2042ev_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
2054void 2077void
2055ev_idle_stop (EV_P_ ev_idle *w) 2078ev_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
2084void 2107void
2085ev_prepare_stop (EV_P_ ev_prepare *w) 2108ev_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
2111void 2134void
2112ev_check_stop (EV_P_ ev_check *w) 2135ev_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
2163void 2186void
2164ev_embed_stop (EV_P_ ev_embed *w) 2187ev_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
2188void 2211void
2189ev_fork_stop (EV_P_ ev_fork *w) 2212ev_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;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines