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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines