mecrazycoder:
Provide your first attempt at a script, and we'd be delighted to help you. Most of us aren't very interested in just doing your homework for you, though. Read up on threads (perldoc threads), give it a try, and see how far you can get. We'll help you when you get stuck.
...roboticus | [reply] [d/l] |
Also, start simple.
First grab the example code from the docs, and get that running. Then you can slowly start making it spawn more kids, and have the children do gradually more interesting things until it has grown to the point where it is doing what you wanted in the OP.
Of course, given the description, you might just want to use a batch file instead. Copy paste 12 lines of launching background perl interpreters, and you're done.
| [reply] |
First show us the code you have so far. Second, would it be easier (if not necessarily better) to fork off child processes instead of using threads? Based on the nature of the problem and the code you have, we might tell you to fork off.
Er, wait, let me rephrase that ...
--
tbone1, YAPS (Yet Another Perl Schlub)
And remember, if he succeeds, so what.
- Chick McGee
| [reply] |
If all you want is 12 separate processes each running file2.pl then you don't need threads in file1.pl.
I find that simple solutions are easier to write and maintain than more complex solutions. Therefore, I would not use threads in file1.pl unless there was a compelling reason for them. I suggest you think carefully about why you want to use threads. Maybe it's not necessary.
If you explain why system and fork are inadequate for your needs, it will be easier to provide helpful suggestions.
| [reply] |