>
> Yeah, that's what I ended up doing, and defining some global variables so
> that I could re-use the previous functions I created, thanks for the help!
>
> One other question I had, is pcntl_waitpid necessary in this case? Passing
> WNOHANG to it causes it to return immediately regardless of whether the
> child has exited or not, and my previous test when I didn't use
> pcntl_waitpid seemed to not leave any zombies as well. Would it be fine
> just to spawn off the child, and have the child exit at the end, and
> continue on my merry way with the parent without checking the status of the
> child?
>
> As a more general question, I'm worried that if I just keep the script as
> is, it's going to spawn off some crazy number of processes if I don't cap
> it. The first solution I came up with is to use a static variable in the
> parent thread, and then sleep every 20 threads or so. The most robust
> solution would be to build logic into the calling function to actually check
> for pids and only dispatch new threads when old ones had finished, but that
> requires changing multiple places, while this can be localised to just the
> dispatcher function. Does the first solution I propose seem sane?
>
> Waynn
>
>
Actually, I just had another thought. I could take away the WNOHANG from
pcntl_waitpid, and every 20 or so threads, wait for one to complete. It
won't be precise, but it'll more or less queue them up in batches of 20 for
sending.