… | |
… | |
3592 | |
3592 | |
3593 | ev_start (EV_A_ (W)w, ++cleanupcnt); |
3593 | ev_start (EV_A_ (W)w, ++cleanupcnt); |
3594 | array_needsize (ev_cleanup *, cleanups, cleanupmax, cleanupcnt, EMPTY2); |
3594 | array_needsize (ev_cleanup *, cleanups, cleanupmax, cleanupcnt, EMPTY2); |
3595 | cleanups [cleanupcnt - 1] = w; |
3595 | cleanups [cleanupcnt - 1] = w; |
3596 | |
3596 | |
|
|
3597 | /* cleanup watchers should never keep a refcount on the loop */ |
|
|
3598 | ev_unref (EV_A); |
3597 | EV_FREQUENT_CHECK; |
3599 | EV_FREQUENT_CHECK; |
3598 | } |
3600 | } |
3599 | |
3601 | |
3600 | void |
3602 | void |
3601 | ev_cleanup_stop (EV_P_ ev_cleanup *w) |
3603 | ev_cleanup_stop (EV_P_ ev_cleanup *w) |
… | |
… | |
3603 | clear_pending (EV_A_ (W)w); |
3605 | clear_pending (EV_A_ (W)w); |
3604 | if (expect_false (!ev_is_active (w))) |
3606 | if (expect_false (!ev_is_active (w))) |
3605 | return; |
3607 | return; |
3606 | |
3608 | |
3607 | EV_FREQUENT_CHECK; |
3609 | EV_FREQUENT_CHECK; |
|
|
3610 | ev_ref (EV_A); |
3608 | |
3611 | |
3609 | { |
3612 | { |
3610 | int active = ev_active (w); |
3613 | int active = ev_active (w); |
3611 | |
3614 | |
3612 | cleanups [active - 1] = cleanups [--cleanupcnt]; |
3615 | cleanups [active - 1] = cleanups [--cleanupcnt]; |