roadrunner has asked for the wisdom of the Perl Monks concerning the following question:
Hi,
I'm trying to find the most processor-efficient way of writing some code to do the following:
someLoop { ... ... do stuff ... ... if(I *don't* have one and only one child proc running) { launch asynchronous child process } ... ... carry on doing stuff while child runs ... ... }
I've played around a bit with fork(), but:
(a) Do not know whether it is the most efficient and stable way of doing this.
(b) Do not have enough Perl experience to be able to ensure I only ever have JUST ONE child running at any time. I only seem to be able to fork multiple processes.
Any advice, particularly code examples, would be appreciated...especially for how I can do the check in the if statement.
Thanks,
Roadrunner.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: How to fork one and only one child process from a loop ?
by idsfa (Vicar) on Mar 18, 2006 at 04:50 UTC | |
|
Re: How to fork one and only one child process from a loop ?
by graff (Chancellor) on Mar 18, 2006 at 23:12 UTC | |
|
Re: How to fork one and only one child process from a loop ?
by salva (Canon) on Mar 19, 2006 at 18:06 UTC |