David Holland <[email protected]> wrote: > It might be necessary to try waiting a second time, because it might > not be able to know how many children have exited (depends if they all
Yes, SIGCHLD tells you that at least one children died. So looping on waitpid is needed. > trigger some EOF or just most of them) but it should not need to > blindly call waitpid every time through the main select/poll loop. Indeed. > Right now the SIGCHLD handler works by writing into a pipe that the > main loop polls, which is pretty grotty. It shouldn't need to do > anything other than set a global (of type sig_atomic_t, to be > portable) to 1. The delivery of a signal should cause all select and > poll variants to fail with EINTR (that is, stop for attention) even if > nothing else is pending. It now sets the flag thus the pipe may be superfluous.
