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

Rodrigo Kumpera kumpera at gmail.com
Fri Mar 18 13:46:35 EDT 2011

On Fri, Mar 18, 2011 at 3:33 PM, Rolf Bjarne Kvinge <rolflists at ya.com>wrote:

> Hi,
> There is a slight problem now which I just found out: SIGCHLD isn't 100%
> reliable. If I start 100 threads, each of them spawning a process, I
> usually
> get 98-99 signals (unless I run in gdb, in which case I get the same number
> of signals, but info->si_pid is duplicated in many of them...). This means
> that only waiting for the reported pid will quite often lead to a zombie
> process in my (pathological) test case.
> Attaching revised patch (which is identical to the one in my response to
> Rodrigo).
Patch looks good except for the missing cleanup on shutdown. The way is to
hook it up on _wapi_cleanup.

Signal delivery is never reliable. You patch will probably behave even worse
on osx which doesn't implement posix real time extensions.

The worst part is that to do this reliably, one can only depend on OS

On linux use signalfd with a thread doing a blocking read on it. On OSX you
need to use mach primitives. Other posix-based systems with suck with the
signal version until patches are submitted.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20110318/2e5f7b29/attachment.html 

More information about the Mono-devel-list mailing list