View Single Post
  #2   (View Single Post)  
Old 25th March 2009
robbak's Avatar
robbak robbak is offline
Real Name: Robert Backhaus
VPN Cryptographer
 
Join Date: May 2008
Location: North Queensland, Australia
Posts: 366
Default

The big issue with this pseudo code is that you are busy-waiting on that $ALIVE variable: always a bad idea. While $ALIVE; do sleep(n); done would be better, but not much.
If this was done, you would need a separate function that waited on the jobs more efficiently than that busy waiting. A busy wait (Hmm, I hope that is the name for a hard loop like this(It is: Thanks wikipedia)) is the definition of inefficient programming.
I also am not sure if shell variables could be used in this way: the called program would have it's own environment, so $ALIVE in the calling process would remain untouched.
My syntax would look more like this.
Code:
jobid == fork $remote_program
exec $local_program
fork-wait $jobid
This (or something similar) could probably be done using current shell commands: & of a process, and check/wait on it's job number. (Maybe you'd have to do that with a busywait, though.
__________________
The only dumb question is a question not asked.
The only dumb answer is an answer not given.

Last edited by robbak; 25th March 2009 at 06:01 AM.
Reply With Quote