:: Re: [DNG] Doing away with multi-thr…
Forside
Slet denne besked
Besvar denne besked
Skribent: Rainer Weikusat
Dato:  
Til: dng
Emne: Re: [DNG] Doing away with multi-threading in my project (netman)
Edward Bartolo <edbarx@???> writes:

> Hi,
>
> For the last days I have been struggling to reap zombies adopted by
> the frontend with only failures.


The frontend doesn't adopt zombies. Only init ever does that.

> I tried several methods using wait(-1), waidpid and trapping the
> signal when a child dies without ever succeeding to reap zombies. This
> means, I will stop and will leave the issue open to anyone who can
> find a working solution.


The 'zombie reaping' needs to happen in the parent process. This means
the backend has to care for any processes it starts via fork. And the
frontend has to care for the backend. You can get a tree view of
processes via ps f, eg,

ps fx

to show all processed running under you current uid.

[...]


> initialization
>
> sa.sa_handler := @handle_sigchld;


Insofar the documentation goes, you should be able to replace this with

sa.sa_handler := SIG_IGN;

this means now direct backend processes will ever be zombified. As the
backend is written in C, a single

signal(SIGCHLD, SIG_IGN);

will take care of all processes spawned by the backend.