Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:11.0) Gecko/20120327 Thunderbird/11.0.1
On 5/5/12 11:25 PM, John Kearney wrote:
> Is there actually a guarantee that there will be 1 SIGCHLD for every
> exited process.
The manual page says, under JOB CONTROL:
Any trap on SIGCHLD is executed for each child that exits.
> Isn't it actually a race condition?
No. waitpid() returns once for each child that exits. That's why you
loop calling waitpid() when you get a SIGCHLD. It keeps returning PIDs
until there are no more unreaped children, then it returns -1.
Chet
--
``The lyf so short, the craft so long to lerne.'' - Chaucer
``Ars longa, vita brevis'' - Hippocrates
Chet Ramey, ITS, CWRU chet@case.edu http://cnswww.cns.cwru.edu/~chet/