Subject: Bug or expected behavior?
To: None <firstname.lastname@example.org>
From: Seth Kurtzberg <email@example.com>
Date: 10/16/2001 21:17:16
-----BEGIN PGP SIGNED MESSAGE-----
I have a set of circumstances that I believe is a bug, provided I understand
the semantics of the situation.
I have a parent process that spawns child processes using fork/exec.
Periodically, the parent process calls waitpid with the WNOHANG option.
Most of the time this works as expected. However, if a child process is
blocked on a select() call at the time the parent calls waitpid(), then
waitpid() does not return despite the WNOHANG option. The nature of the
operation is that there are circumstances in which the child process will
block on a select for several minutes.
Is this behavior correct for waitpid()? Shouldn't it return immediately
(with the WNOHANG option) regardless of the state of the child?
I've worked around the problem by using select() with a timeout in the child
process, and calling it repeatedly. This is inefficient, however, and causes
unnecessary context switching.
Machine Independent Software
Office: (480) 661-1849
Fax: (480) 614-8909
pager: 888-605-9296 or email firstname.lastname@example.org
-----BEGIN PGP SIGNATURE-----
Version: PGP 6.5.8
-----END PGP SIGNATURE-----