[Mono-dev] [PATCHES] Improve process exit/wait handling

Gonzalo Paniagua Javier gonzalo.mono at gmail.com
Thu Mar 17 01:03:28 EDT 2011


Awesome patches. Comments below.

On Thu, 2011-03-17 at 00:26 +0100, Rolf Bjarne Kvinge wrote:
[...]
> 4) Improve waiting on processes a lot
> 
>    Here are all the juicy bits: I changed process waiting to use
>    a SIGCHLD handler and automatically wait on all processes.
>    This fixes #668867. I also added a semaphore, so waits are now
>    properly handled by using that semaphore instead of polling
>    every 100ms.

In mono_sigchld_signal_handler(), there's this line:

	while ((pid = waitpid (-1, &status, WNOHANG)) > 0) {

You need to handle EINTR. Also info->si_pid has the PID of the process
that triggered the signal so you could avoid doing a 'while' and call
waitpid() like "waitpid (info->si_pid, ...".

-Gonzalo




More information about the Mono-devel-list mailing list