tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: SIGCHLD and sigaction()



>> I don't understand what problem queued SIGCHLD was invented to
>> address.

> My impression is that it allows you to get notified of state changes
> of your child processes.  If one signal could annonce several state
> changes, how would you know what these state changes are?

You'd call wait4(2) (or waitpid or wait3) with WNOHANG until it
returned 0 (or returned -1 with ECHILD), collecting one child status
change each time.  You'd still need to do more or less the same with
queued SIGCHLD; the only difference is it would let you skip the
WNOHANG and call it exactly once per signal.  (Unless a single child
changed state twice, such as by being stopped and then killed, in which
case the implementation had better queue wait stati as well or you'll
be calling wait too often!)

/~\ The ASCII				  Mouse
\ / Ribbon Campaign
 X  Against HTML		mouse%rodents-montreal.org@localhost
/ \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B


Home | Main Index | Thread Index | Old Index