… | |
… | |
817 | } |
817 | } |
818 | |
818 | |
819 | void inline_size |
819 | void inline_size |
820 | evpipe_write (EV_P_ int sig, int async) |
820 | evpipe_write (EV_P_ int sig, int async) |
821 | { |
821 | { |
822 | if (!(gotasync || gotsig)) |
822 | int sent = gotasync || gotsig; |
|
|
823 | |
|
|
824 | if (sig) gotsig = 1; |
|
|
825 | if (async) gotasync = 1; |
|
|
826 | |
|
|
827 | if (!sent) |
823 | { |
828 | { |
824 | int old_errno = errno; /* save errno becaue write might clobber it */ |
829 | int old_errno = errno; /* save errno becaue write might clobber it */ |
825 | |
|
|
826 | if (sig) gotsig = 1; |
|
|
827 | if (async) gotasync = 1; |
|
|
828 | |
|
|
829 | write (evpipe [1], &old_errno, 1); |
830 | write (evpipe [1], &old_errno, 1); |
830 | |
|
|
831 | errno = old_errno; |
831 | errno = old_errno; |
832 | } |
832 | } |
833 | } |
833 | } |
834 | |
834 | |
835 | static void |
835 | static void |
… | |
… | |
838 | { |
838 | { |
839 | int dummy; |
839 | int dummy; |
840 | read (evpipe [0], &dummy, 1); |
840 | read (evpipe [0], &dummy, 1); |
841 | } |
841 | } |
842 | |
842 | |
843 | if (gotsig) |
843 | if (gotsig && ev_is_default_loop (EV_A)) |
844 | { |
844 | { |
845 | int signum; |
845 | int signum; |
846 | gotsig = 0; |
846 | gotsig = 0; |
847 | |
847 | |
848 | for (signum = signalmax; signum--; ) |
848 | for (signum = signalmax; signum--; ) |
… | |
… | |
1218 | #endif |
1218 | #endif |
1219 | |
1219 | |
1220 | if (ev_is_active (&pipeev)) |
1220 | if (ev_is_active (&pipeev)) |
1221 | { |
1221 | { |
1222 | /* this "locks" the handlers against writing to the pipe */ |
1222 | /* this "locks" the handlers against writing to the pipe */ |
|
|
1223 | /* while we modify the fd vars */ |
|
|
1224 | gotsig = 1; |
|
|
1225 | #if EV_ASYNC_ENABLE |
1223 | gotsig = gotasync = 1; |
1226 | gotasync = 1; |
|
|
1227 | #endif |
1224 | |
1228 | |
1225 | ev_ref (EV_A); |
1229 | ev_ref (EV_A); |
1226 | ev_io_stop (EV_A_ &pipeev); |
1230 | ev_io_stop (EV_A_ &pipeev); |
1227 | close (evpipe [0]); |
1231 | close (evpipe [0]); |
1228 | close (evpipe [1]); |
1232 | close (evpipe [1]); |