9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: Joel Salomon <chesky@plan9.jp>
To: 9fans@cse.psu.edu
Subject: [9fans] waitpid
Date: Tue,  7 Nov 2006 20:02:04 -0500	[thread overview]
Message-ID: <395de4ae6c3cfafa27c79d2734560aa5@plan9.jp> (raw)

I’m trying to wait for all child processes to finish.  The lunix code my professor gave me for this was:
	while (wait(&wstat)>0)
		;
which I naïvely translated as:
	while(waitpid() != 0)
		;
which hangs.  Evidently waitpid returns something other than 0 when there are no children, but what?  The man page wait(2) doesn’t say, nor does it point to the source for waitpid.

--Joel



             reply	other threads:[~2006-11-08  1:02 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-11-08  1:02 Joel Salomon [this message]
2006-11-08  1:08 ` Joel Salomon
2006-11-08  1:13   ` geoff
2006-11-08  1:10 ` Russ Cox
2006-11-08  1:15   ` Joel Salomon
2006-11-08  1:25     ` Joel Salomon
2006-11-08  1:28     ` Bruce Ellis
2006-11-08  2:30       ` Federico Benavento
2006-11-08  6:55         ` Bruce Ellis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=395de4ae6c3cfafa27c79d2734560aa5@plan9.jp \
    --to=chesky@plan9.jp \
    --cc=9fans@cse.psu.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).