… | |
… | |
912 | #ifndef WIFCONTINUED |
912 | #ifndef WIFCONTINUED |
913 | # define WIFCONTINUED(status) 0 |
913 | # define WIFCONTINUED(status) 0 |
914 | #endif |
914 | #endif |
915 | |
915 | |
916 | void inline_speed |
916 | void inline_speed |
917 | child_reap (EV_P_ ev_signal *sw, int chain, int pid, int status) |
917 | child_reap (EV_P_ int chain, int pid, int status) |
918 | { |
918 | { |
919 | ev_child *w; |
919 | ev_child *w; |
920 | int traced = WIFSTOPPED (status) || WIFCONTINUED (status); |
920 | int traced = WIFSTOPPED (status) || WIFCONTINUED (status); |
921 | |
921 | |
922 | for (w = (ev_child *)childs [chain & (EV_PID_HASHSIZE - 1)]; w; w = (ev_child *)((WL)w)->next) |
922 | for (w = (ev_child *)childs [chain & (EV_PID_HASHSIZE - 1)]; w; w = (ev_child *)((WL)w)->next) |
923 | { |
923 | { |
924 | if ((w->pid == pid || !w->pid) |
924 | if ((w->pid == pid || !w->pid) |
925 | && (!traced || (w->flags & 1))) |
925 | && (!traced || (w->flags & 1))) |
926 | { |
926 | { |
927 | ev_set_priority (w, ev_priority (sw)); /* need to do it *now* */ |
927 | ev_set_priority (w, EV_MAXPRI); /* need to do it *now*, this *must* be the same prio as the signal watcher itself */ |
928 | w->rpid = pid; |
928 | w->rpid = pid; |
929 | w->rstatus = status; |
929 | w->rstatus = status; |
930 | ev_feed_event (EV_A_ (W)w, EV_CHILD); |
930 | ev_feed_event (EV_A_ (W)w, EV_CHILD); |
931 | } |
931 | } |
932 | } |
932 | } |
… | |
… | |
946 | if (!WCONTINUED |
946 | if (!WCONTINUED |
947 | || errno != EINVAL |
947 | || errno != EINVAL |
948 | || 0 >= (pid = waitpid (-1, &status, WNOHANG | WUNTRACED))) |
948 | || 0 >= (pid = waitpid (-1, &status, WNOHANG | WUNTRACED))) |
949 | return; |
949 | return; |
950 | |
950 | |
951 | /* make sure we are called again until all childs have been reaped */ |
951 | /* make sure we are called again until all children have been reaped */ |
952 | /* we need to do it this way so that the callback gets called before we continue */ |
952 | /* we need to do it this way so that the callback gets called before we continue */ |
953 | ev_feed_event (EV_A_ (W)sw, EV_SIGNAL); |
953 | ev_feed_event (EV_A_ (W)sw, EV_SIGNAL); |
954 | |
954 | |
955 | child_reap (EV_A_ sw, pid, pid, status); |
955 | child_reap (EV_A_ pid, pid, status); |
956 | if (EV_PID_HASHSIZE > 1) |
956 | if (EV_PID_HASHSIZE > 1) |
957 | child_reap (EV_A_ sw, 0, pid, status); /* this might trigger a watcher twice, but feed_event catches that */ |
957 | child_reap (EV_A_ 0, pid, status); /* this might trigger a watcher twice, but feed_event catches that */ |
958 | } |
958 | } |
959 | |
959 | |
960 | #endif |
960 | #endif |
961 | |
961 | |
962 | /*****************************************************************************/ |
962 | /*****************************************************************************/ |