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    c...@case.edu    http://cnswww.cns.cwru.edu/~chet/

Reply via email to