On 3/23/19 5:15 PM, Ben Elliston wrote: > On Sat, Mar 23, 2019 at 11:48:33AM -0400, Chet Ramey wrote: > >> What's your goal here? If you want to associate an exit status with >> a process, you're going to have to save $! and wait for each process >> in turn. > > My goal is to run a small process pool where upon one process > completes, another one is started immediately. If I start (say) 10 > processes and then wait on the first, I may have chosen the longest > running process.
OK. This sounds like a candidate for a SIGCHLD trap. You're not interested in a particular process's exit status, so you can keep a count of running processes and start new ones out of a trap handler. Chet -- ``The lyf so short, the craft so long to lerne.'' - Chaucer ``Ars longa, vita brevis'' - Hippocrates Chet Ramey, UTech, CWRU c...@case.edu http://tiswww.cwru.edu/~chet/
signature.asc
Description: OpenPGP digital signature