Date: Wed, 07 Apr 1999 21:49:59 -0400 (EDT) From: Simon Shapiro <shimon@simon-shapiro.org> To: Don Lewis <Don.Lewis@tsc.tdk.com> Cc: freebsd-hackers@FreeBSD.ORG Subject: Re: wait4 - Proof I am stupid Message-ID: <XFMail.990407214959.shimon@simon-shapiro.org> In-Reply-To: <199904080047.RAA17480@salsa.gv.tsc.tdk.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On 08-Apr-99 Don Lewis wrote: > On Apr 7, 8:32pm, Simon Shapiro wrote: > } Subject: wait4 - Proof I am stupid > > } /* > } * So far, this code should (and does) fork a process. > } * This process (child then changes its process group to something > else > } * than the parent and then forks 10 children. > } * > } * Now the parent wants to wait for the grandchidren... > } */ > > I don't believe that it is possible to wait for processes other than > immediate children. Then the man pages lie. They (both Linux and FreeBSD) say: ... The wpid parameter specifies the set of child processes for which to wait. If wpid is -1, the call waits for any child process. If wpid is 0, the call waits for any child process in the process group of the caller. If wpid is greater than zero, the call waits for the process with process id wpid. If wpid is less than -1, the call waits for any process whose process group id equals the absolute value of wpid. Nowhere does it say what you say. This is not to say you are wrong! In case you are right, how would you go about accomplishing what I want: I have a set of worker processes, which need to get certain signals. They are being managed by a monitor process which may need to get the same signals but react quite differently. Also, the monitor must wait for all the workers to exit, before doing some other work. I could make the shared memory channel more complex and signal completion that way, but this is uncertain and ugly (if a grandson dies without first telling grandpa ``I'm gone'' how is grandpa to know? Simon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?XFMail.990407214959.shimon>