You don't want a limit of 15 actions, do you? You want to process every element. In my example, I had 15 elements - it was easier to hard-code the elements than to try and provide a data file for you to read, too..
The line
If $Workers < 10
is what controls the number of child worker threads. Change it to
If $Workers < $MaxWorkers
and Dim/define $MaxWorkers at the beginning to limit the number of concurrent child processes running. Like I said, I have it set to 50, which runs the server at 100% CPU load for 10-12 minutes. It's trial and error - My server is dedicated to this task at the time it runs, so, I fully load it to get the job done. If your server is shared, you can keep increasing the MaxWorkers value until you hit 50% load or so .
Bottom line - my "first" outer loop has been modified to run once for each value read from the file, which is what you need in order to process a random number of elements. The middle loop keeps reading the data, and the innermost loop simply keeps the number of child processes at 10 (or, better yet, $MaxWorkers).
Glenn
_________________________
Actually I
am a Rocket Scientist!