… | |
… | |
397 | { |
397 | { |
398 | pendings [ABSPRI (w_)][w_->pending - 1].events |= revents; |
398 | pendings [ABSPRI (w_)][w_->pending - 1].events |= revents; |
399 | return; |
399 | return; |
400 | } |
400 | } |
401 | |
401 | |
|
|
402 | if (expect_false (!w_->cb)) |
|
|
403 | return; |
|
|
404 | |
402 | w_->pending = ++pendingcnt [ABSPRI (w_)]; |
405 | w_->pending = ++pendingcnt [ABSPRI (w_)]; |
403 | array_needsize (ANPENDING, pendings [ABSPRI (w_)], pendingmax [ABSPRI (w_)], pendingcnt [ABSPRI (w_)], EMPTY2); |
406 | array_needsize (ANPENDING, pendings [ABSPRI (w_)], pendingmax [ABSPRI (w_)], pendingcnt [ABSPRI (w_)], EMPTY2); |
404 | pendings [ABSPRI (w_)][w_->pending - 1].w = w_; |
407 | pendings [ABSPRI (w_)][w_->pending - 1].w = w_; |
405 | pendings [ABSPRI (w_)][w_->pending - 1].events = revents; |
408 | pendings [ABSPRI (w_)][w_->pending - 1].events = revents; |
406 | } |
409 | } |
… | |
… | |
813 | // flags &= ~EVBACKEND_KQUEUE; for documentation |
816 | // flags &= ~EVBACKEND_KQUEUE; for documentation |
814 | flags &= ~EVBACKEND_POLL; |
817 | flags &= ~EVBACKEND_POLL; |
815 | #endif |
818 | #endif |
816 | |
819 | |
817 | return flags; |
820 | return flags; |
|
|
821 | } |
|
|
822 | |
|
|
823 | unsigned int |
|
|
824 | ev_embeddable_backends (void) |
|
|
825 | { |
|
|
826 | return EVBACKEND_EPOLL |
|
|
827 | | EVBACKEND_KQUEUE |
|
|
828 | | EVBACKEND_PORT; |
818 | } |
829 | } |
819 | |
830 | |
820 | unsigned int |
831 | unsigned int |
821 | ev_backend (EV_P) |
832 | ev_backend (EV_P) |
822 | { |
833 | { |
… | |
… | |
1659 | |
1670 | |
1660 | wlist_del ((WL *)&childs [w->pid & (PID_HASHSIZE - 1)], (WL)w); |
1671 | wlist_del ((WL *)&childs [w->pid & (PID_HASHSIZE - 1)], (WL)w); |
1661 | ev_stop (EV_A_ (W)w); |
1672 | ev_stop (EV_A_ (W)w); |
1662 | } |
1673 | } |
1663 | |
1674 | |
|
|
1675 | #if EV_MULTIPLICITY |
|
|
1676 | static void |
|
|
1677 | embed_cb (EV_P_ struct ev_io *io, int revents) |
|
|
1678 | { |
|
|
1679 | struct ev_embed *w = (struct ev_embed *)(((char *)io) - offsetof (struct ev_embed, io)); |
|
|
1680 | |
|
|
1681 | ev_feed_event (EV_A_ (W)w, EV_EMBED); |
|
|
1682 | ev_loop (w->loop, EVLOOP_NONBLOCK); |
|
|
1683 | } |
|
|
1684 | |
|
|
1685 | void |
|
|
1686 | ev_embed_start (EV_P_ struct ev_embed *w) |
|
|
1687 | { |
|
|
1688 | if (expect_false (ev_is_active (w))) |
|
|
1689 | return; |
|
|
1690 | |
|
|
1691 | { |
|
|
1692 | struct ev_loop *loop = w->loop; |
|
|
1693 | assert (("loop to be embedded is not embeddable", backend & ev_embeddable_backends ())); |
|
|
1694 | ev_io_init (&w->io, embed_cb, backend_fd, EV_READ); |
|
|
1695 | } |
|
|
1696 | |
|
|
1697 | ev_io_start (EV_A_ &w->io); |
|
|
1698 | ev_start (EV_A_ (W)w, 1); |
|
|
1699 | } |
|
|
1700 | |
|
|
1701 | void |
|
|
1702 | ev_embed_stop (EV_P_ struct ev_embed *w) |
|
|
1703 | { |
|
|
1704 | ev_clear_pending (EV_A_ (W)w); |
|
|
1705 | if (expect_false (!ev_is_active (w))) |
|
|
1706 | return; |
|
|
1707 | |
|
|
1708 | ev_io_stop (EV_A_ &w->io); |
|
|
1709 | ev_stop (EV_A_ (W)w); |
|
|
1710 | } |
|
|
1711 | #endif |
|
|
1712 | |
1664 | /*****************************************************************************/ |
1713 | /*****************************************************************************/ |
1665 | |
1714 | |
1666 | struct ev_once |
1715 | struct ev_once |
1667 | { |
1716 | { |
1668 | struct ev_io io; |
1717 | struct ev_io io; |