Calling os.waitpid() From Secondary Thread Under Linux 2.2.12-20?
rwiserREMOVEthis at mindspring.com
Tue Apr 11 19:48:11 CEST 2000
(Apologies if this is a duplicate, it's been awhile since I've posted
I've written a small python program that spawns one child process from
its main thread, and then creates a second thread. The sole purpose
of the second thread (at this point) is to call os.waitpid(processID,
0) to wait for the child that the main thread created. This works
fine under Solaris when I call os.waitpid() from the second thread.
But, under Linux 2.2.12-20 I get the following OSError exception:
[Errno 10] No child processes
However, if (under Linux still) I call waitpid() from the main thread
(as a test), the call does indeed wait until the child process
After scouring some of the Linux newsgroups, I've gathered that
threads spawned under Linux may have SIGCHLD signals (and other
signals) blocked, and that this _may_ be the reason I get the error,
even though the processID I pass is for a valid process.
Unfortunately there seems to be no easy way to set the signal mask for
the second thread. Has anyone else run into this situation, and if so
can you advise how you solved it?
Thanks in advance,
More information about the Python-list