:: Re: [DNG] Doing away with multi-thr…
Αρχική Σελίδα
Delete this message
Reply to this message
Συντάκτης: KatolaZ
Ημερομηνία:  
Προς: KatolaZ
Υ/ο: dng
Αντικείμενο: Re: [DNG] Doing away with multi-threading in my project (netman)
On Thu, Sep 03, 2015 at 06:53:46PM +0100, KatolaZ wrote:

[cut]

>
> OK, I admit it might had been a tad too cryptic, but my intentions
> were good. What I mean is that the parent has to set a handler for
> SIGCHLD, and the handler has to call wait() [or waitpid(-1, &status)]
> to reap the dead child. The handler must be set *before* any of the
> children is ever spawn, otherwise there is still a concrete chance to
> create zombies.
>
> If your parent process handles SIGCHLD correctly, you can also force
> reaping by sending it a SIGCHLD with the kill command.
>


To make things more clear, here is a minimal example:

http://www.linuxprogrammingblog.com/code-examples/SIGCHLD-handler

Beware that in this case the children do nothing (they just exit
immediately), and the final while(sleep(1)) is not required.

My2Cents

KatolaZ

--
[ Enzo Nicosia aka KatolaZ --- GLUG Catania -- Freaknet Medialab ]
[ me [at] katolaz.homeunix.net -- http://katolaz.homeunix.net -- ]
[ GNU/Linux User:#325780/ICQ UIN: #258332181/GPG key ID 0B5F062F ]
[ Fingerprint: 8E59 D6AA 445E FDB4 A153 3D5A 5F20 B3AE 0B5F 062F ]