Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Main start Hello. I want a nap. Hello. I just slept 10 seconds. Started hello: 2352 Middle: I'm impatient, so I will print now. '1' is not recognized as an internal or external command, operable program or batch file. '1' is not recognized as an internal or external command, operable program or batch file. Started middle: 356 356, EXIT, 256 2352, EXIT, 256 Ciao. All the parallel parts are done. Main end
Could someone please explain? :)$pid = Parallel::Jobs::start_job({ stdin_file => filename | stdin_handle => *HANDLE, stdout_handle => *HANDLE | stdout_capture => 1, stderr_handle => *HANDLE | stderr_capture => 1 }, ... cmd as above ...);
#!/usr/bin/perl -w use strict; use Parallel::Jobs; my($pid, $pid2); print "Main start\n"; $pid = Parallel::Jobs::start_job(\&hello()); print "Started hello: $pid\n"; $pid2 = Parallel::Jobs::start_job(\&middle()); print "Started middle: $pid2\n"; my ($pid_new, $event, $data) = Parallel::Jobs::watch_jobs(); while(defined($event)) { print "$pid_new, $event, $data\n"; ($pid_new, $event, $data) = Parallel::Jobs::watch_jobs(); } ciao(); print "Main end\n"; exit 0; ################################# #subroutines ################################# sub hello{ print "Hello. I want a nap.\n"; sleep(10); print "Hello. I just slept 10 seconds.\n"; } sub middle{ print "Middle: I'm impatient, so I will print now.\n"; } sub ciao{ print "Ciao. All the parallel parts are done.\n"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem's with Parallel::Jobs
by RMGir (Prior) on Sep 11, 2002 at 11:58 UTC |