Multi-threaded BASH programming - generalized method?
问题 Ok, I was running POV-Ray on all the demos, but POV's still single-threaded and wouldn't utilize more than one core. So, I started thinking about a solution in BASH. I wrote a general function that takes a list of commands and runs them in the designated number of sub-shells. This actually works but I don't like the way it handles accessing the next command in a thread-safe multi-process way: It takes, as an argument, a file with commands (1 per line), To get the "next" command, each process