in reply to Re^2: Reading from a pipe
in thread Reading from a pipe
The problem is that the readline blocks until it has read a line (irrespective of whether you use it in list or scalar context). So despite your non-blocking waitpid(-1,WUNTRACED) you won't start a new child before the old one has written a line to the pipe. In other words, as you have it, your pings will still run sequentially (just as they would without the additional fork/wait wrapped around the backticks call).
If you want to run several child processes in parallel, you'd have to have independent pipes, and (for example) read from them in a select loop when they're ready (the other form of select, that is, not the one you're already using in your code).
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Reading from a pipe
by hello_world (Acolyte) on Nov 20, 2011 at 15:13 UTC | |
|
Re^4: Reading from a pipe
by hello_world (Acolyte) on Nov 20, 2011 at 15:27 UTC |