ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/libev/ev.c
(Generate patch)

Comparing libev/ev.c (file contents):
Revision 1.141 by root, Mon Nov 26 20:33:58 2007 UTC vs.
Revision 1.142 by root, Tue Nov 27 06:19:08 2007 UTC

715 715
716#ifndef _WIN32 716#ifndef _WIN32
717 717
718static ev_signal childev; 718static ev_signal childev;
719 719
720#ifndef WCONTINUED
721# define WCONTINUED 0
722#endif
723
724void inline_speed 720void inline_speed
725child_reap (EV_P_ ev_signal *sw, int chain, int pid, int status) 721child_reap (EV_P_ ev_signal *sw, int chain, int pid, int status)
726{ 722{
727 ev_child *w; 723 ev_child *w;
728 724
734 w->rstatus = status; 730 w->rstatus = status;
735 ev_feed_event (EV_A_ (W)w, EV_CHILD); 731 ev_feed_event (EV_A_ (W)w, EV_CHILD);
736 } 732 }
737} 733}
738 734
735#ifndef WCONTINUED
736# define WCONTINUED 0
737#endif
738
739static void 739static void
740childcb (EV_P_ ev_signal *sw, int revents) 740childcb (EV_P_ ev_signal *sw, int revents)
741{ 741{
742 int pid, status; 742 int pid, status;
743 743
744 /* some systems define WCONTINUED but then fail to support it (linux 2.4) */
744 if (0 < (pid = waitpid (-1, &status, WNOHANG | WUNTRACED | WCONTINUED))) 745 if (0 >= (pid = waitpid (-1, &status, WNOHANG | WUNTRACED | WCONTINUED)))
745 { 746 if (!WCONTINUED
747 || errno != EINVAL
748 || 0 >= (pid = waitpid (-1, &status, WNOHANG | WUNTRACED)))
749 return;
750
746 /* make sure we are called again until all childs have been reaped */ 751 /* make sure we are called again until all childs have been reaped */
747 /* we need to do it this way so that the callback gets called before we continue */ 752 /* we need to do it this way so that the callback gets called before we continue */
748 ev_feed_event (EV_A_ (W)sw, EV_SIGNAL); 753 ev_feed_event (EV_A_ (W)sw, EV_SIGNAL);
749 754
750 child_reap (EV_A_ sw, pid, pid, status); 755 child_reap (EV_A_ sw, pid, pid, status);
751 child_reap (EV_A_ sw, 0, pid, status); /* this might trigger a watcher twice, but feed_event catches that */ 756 child_reap (EV_A_ sw, 0, pid, status); /* this might trigger a watcher twice, but feed_event catches that */
752 }
753} 757}
754 758
755#endif 759#endif
756 760
757/*****************************************************************************/ 761/*****************************************************************************/

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines