On 1/14/15 6:01 AM, Øyvind 'bolt' Hvidsten wrote: > I'm responsible for a couple of scripts at work, which have used a trap on > CHLD to do some naive parallelisation, starting a new child process when an > existing one ends. > > However, when run under bash 4.3.30, all CHLD traps run at the same time, > so my script runs in chunks, rather than keeping a given amount of > processes running at all times. I've been told I can rewrite it using wait > -n instead, but I'm wondering if this is classified as a bug, or if it's > intended to be that way going forwards.
It's not a bug. The only guarantee is that the CHLD trap gets run once for each child bash reaps. Bash gets SIGCHLD, reaps as many terminated child processes as it can, then runs the CHLD trap once for each terminated child when it's no longer in a signal handler context. I don't have any plans to change this. -- ``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/