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

Comparing libev/ev.c (file contents):
Revision 1.359 by root, Sun Oct 24 17:58:41 2010 UTC vs.
Revision 1.363 by root, Sun Oct 24 19:38:20 2010 UTC

1736void 1736void
1737ev_loop_destroy (EV_P) 1737ev_loop_destroy (EV_P)
1738{ 1738{
1739 int i; 1739 int i;
1740 1740
1741 /* mimic free (0) */
1742 if (!EV_A)
1743 return;
1744
1745#if EV_CLEANUP_ENABLE
1746 /* queue cleanup watchers (and execute them) */
1747 if (expect_false (cleanupcnt))
1748 {
1749 queue_events (EV_A_ (W *)cleanups, cleanupcnt, EV_CLEANUP);
1750 EV_INVOKE_PENDING;
1751 }
1752#endif
1753
1741#if EV_CHILD_ENABLE 1754#if EV_CHILD_ENABLE
1742 if (ev_is_active (&childev)) 1755 if (ev_is_active (&childev))
1743 { 1756 {
1744 ev_ref (EV_A); /* child watcher */ 1757 ev_ref (EV_A); /* child watcher */
1745 ev_signal_stop (EV_A_ &childev); 1758 ev_signal_stop (EV_A_ &childev);
1812#if EV_PERIODIC_ENABLE 1825#if EV_PERIODIC_ENABLE
1813 array_free (periodic, EMPTY); 1826 array_free (periodic, EMPTY);
1814#endif 1827#endif
1815#if EV_FORK_ENABLE 1828#if EV_FORK_ENABLE
1816 array_free (fork, EMPTY); 1829 array_free (fork, EMPTY);
1830#endif
1831#if EV_CLEANUP_ENABLE
1832 array_free (cleanup, EMPTY);
1817#endif 1833#endif
1818 array_free (prepare, EMPTY); 1834 array_free (prepare, EMPTY);
1819 array_free (check, EMPTY); 1835 array_free (check, EMPTY);
1820#if EV_ASYNC_ENABLE 1836#if EV_ASYNC_ENABLE
1821 array_free (async, EMPTY); 1837 array_free (async, EMPTY);
1983 } 1999 }
1984 2000
1985#if EV_FORK_ENABLE 2001#if EV_FORK_ENABLE
1986 assert (forkmax >= forkcnt); 2002 assert (forkmax >= forkcnt);
1987 array_verify (EV_A_ (W *)forks, forkcnt); 2003 array_verify (EV_A_ (W *)forks, forkcnt);
2004#endif
2005
2006#if EV_CLEANUP_ENABLE
2007 assert (cleanupmax >= cleanupcnt);
2008 array_verify (EV_A_ (W *)cleanups, cleanupcnt);
1988#endif 2009#endif
1989 2010
1990#if EV_ASYNC_ENABLE 2011#if EV_ASYNC_ENABLE
1991 assert (asyncmax >= asynccnt); 2012 assert (asyncmax >= asynccnt);
1992 array_verify (EV_A_ (W *)asyncs, asynccnt); 2013 array_verify (EV_A_ (W *)asyncs, asynccnt);
3562 3583
3563 EV_FREQUENT_CHECK; 3584 EV_FREQUENT_CHECK;
3564} 3585}
3565#endif 3586#endif
3566 3587
3588#if EV_CLEANUP_ENABLE
3589void
3590ev_cleanup_start (EV_P_ ev_cleanup *w)
3591{
3592 if (expect_false (ev_is_active (w)))
3593 return;
3594
3595 EV_FREQUENT_CHECK;
3596
3597 ev_start (EV_A_ (W)w, ++cleanupcnt);
3598 array_needsize (ev_cleanup *, cleanups, cleanupmax, cleanupcnt, EMPTY2);
3599 cleanups [cleanupcnt - 1] = w;
3600
3601 /* cleanup watchers should never keep a refcount on the loop */
3602 ev_unref (EV_A);
3603 EV_FREQUENT_CHECK;
3604}
3605
3606void
3607ev_cleanup_stop (EV_P_ ev_cleanup *w)
3608{
3609 clear_pending (EV_A_ (W)w);
3610 if (expect_false (!ev_is_active (w)))
3611 return;
3612
3613 EV_FREQUENT_CHECK;
3614 ev_ref (EV_A);
3615
3616 {
3617 int active = ev_active (w);
3618
3619 cleanups [active - 1] = cleanups [--cleanupcnt];
3620 ev_active (cleanups [active - 1]) = active;
3621 }
3622
3623 ev_stop (EV_A_ (W)w);
3624
3625 EV_FREQUENT_CHECK;
3626}
3627#endif
3628
3567#if EV_ASYNC_ENABLE 3629#if EV_ASYNC_ENABLE
3568void 3630void
3569ev_async_start (EV_P_ ev_async *w) 3631ev_async_start (EV_P_ ev_async *w)
3570{ 3632{
3571 if (expect_false (ev_is_active (w))) 3633 if (expect_false (ev_is_active (w)))

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines