From mboxrd@z Thu Jan 1 00:00:00 1970 Message-ID: Date: Thu, 12 Oct 2006 23:00:26 -0400 From: "Russ Cox" To: "Fans of the OS Plan 9 from Bell Labs" <9fans@cse.psu.edu> Subject: Re: [9fans] waitfor() call question? In-Reply-To: MIME-Version: 1.0 Content-Type: text/plain; charset=WINDOWS-1252; format=flowed Content-Transfer-Encoding: quoted-printable Content-Disposition: inline References: Topicbox-Message-UUID: c97df7f0-ead1-11e9-9d60-3106f5b1d025 > Nemo's book (http://lsub.org/who/nemo/9.intro.pdf, page 91) gives code > for waiting for a particular descendant process if that's what's > wanted. Actually, he uses it for the immediate child process, which > makes me wonder=97after the child process has exited, can the parent > wait() for a grandchild? Nope. > Why is waitfor() "occasionally unavoidable" on UNIX? Because sometimes what would be multiple processes on Plan 9 is a single process on Unix, depending on the implementation of the thread library, and two shared-memory procs each waiting for their own children need not to get the other's child. You could have some shared list of accidentally-waited-for children but then the coordination to wake up the guy who is actually waiting gets cumbersome. Russ