… | |
… | |
810 | fd_intern (evpipe [0]); |
810 | fd_intern (evpipe [0]); |
811 | fd_intern (evpipe [1]); |
811 | fd_intern (evpipe [1]); |
812 | |
812 | |
813 | ev_io_set (&pipeev, evpipe [0], EV_READ); |
813 | ev_io_set (&pipeev, evpipe [0], EV_READ); |
814 | ev_io_start (EV_A_ &pipeev); |
814 | ev_io_start (EV_A_ &pipeev); |
815 | ev_unref (EV_A); /* child watcher should not keep loop alive */ |
815 | ev_unref (EV_A); /* watcher should not keep loop alive */ |
|
|
816 | |
|
|
817 | /* in case we received the signal before we had the chance of installing a handler */ |
|
|
818 | ev_feed_event (EV_A_ &pipeev, 0); |
816 | } |
819 | } |
817 | } |
820 | } |
818 | |
821 | |
819 | void inline_size |
822 | void inline_size |
820 | evpipe_write (EV_P_ int sig, int async) |
823 | evpipe_write (EV_P_ int sig, int async) |
821 | { |
824 | { |
822 | if (!(gotasync || gotsig)) |
825 | if (!(gotasync || gotsig)) |
823 | { |
826 | { |
824 | int old_errno = errno; |
827 | int old_errno = errno; /* save errno becaue write might clobber it */ |
825 | |
828 | |
826 | if (sig) gotsig = 1; |
829 | if (sig) gotsig = 1; |
827 | if (async) gotasync = 1; |
830 | if (async) gotasync = 1; |
828 | |
831 | |
829 | write (evpipe [1], &old_errno, 1); |
832 | write (evpipe [1], &old_errno, 1); |
|
|
833 | |
830 | errno = old_errno; |
834 | errno = old_errno; |
831 | } |
835 | } |
832 | } |
836 | } |
833 | |
837 | |
834 | static void |
838 | static void |
… | |
… | |
837 | { |
841 | { |
838 | int dummy; |
842 | int dummy; |
839 | read (evpipe [0], &dummy, 1); |
843 | read (evpipe [0], &dummy, 1); |
840 | } |
844 | } |
841 | |
845 | |
842 | if (gotsig) |
846 | if (gotsig && ev_is_default_loop (EV_A)) |
843 | { |
847 | { |
844 | int signum; |
848 | int signum; |
845 | gotsig = 0; |
849 | gotsig = 0; |
846 | |
850 | |
847 | for (signum = signalmax; signum--; ) |
851 | for (signum = signalmax; signum--; ) |