Create new process P
while(1) {
read next task
process task
if(P has ended) {
evaluate result of P
Create new process P
} elsif(P should be killed) {
kill P and its children
Create new process P
}
}
In my original solution, 'create new process' was done with system(1,...) and killing was done with kill -9.
--
Ronald Fischer <ynnor@mm.st>
| [reply] [d/l] |
my $job = Win32::Job->new;
my $pid = $job->spawn();
while( 1 ) {
## read and process next task
sleep 3 while $job->status->{ $pid }{ exitcode } == $STILL_RUNNING
+ ## 259??
and not -e 'killfile';
$job->kill if $job->status->{ $pid }{ exitcode } == $STILL_RUNNING
+;
$job = Win32::Job->new;
$pid = $job->spawn( ... )
}
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority".
In the absence of evidence, opinion is indistinguishable from prejudice.
| [reply] [d/l] [select] |
spawn($exe, $args, \%opts);
Creates a new process and associates it with the Job. The proc
+ess is
initially suspended, and can be resumed with one of the other
methods.
I was thinking that this means, spawn creates a new process, but does not actually execute it, and that I would have to execute it with one of the other methods (run or watch). In your example, you use neither of these. How is this supposed to work, respectively, in what way did I misunderstand the documentation?
--
Ronald Fischer <ynnor@mm.st>
| [reply] [d/l] [select] |