Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: Re: forking and ipc

by pizza_milkshake (Monk)
on May 03, 2004 at 05:15 UTC ( [id://349921]=note: print w/replies, xml ) Need Help??


in reply to Re: forking and ipc
in thread forking and ipc

i just realized upon reviewing your description that you want to run a round of burns, then reload all drives at the same time, then do another round, etc. to achieve this, replace the main loop with this:
my $chld; while (@data) { while (@resource) { last unless @data; my $resource = shift @resource; my $data = shift @data; if (($chld = fork()) > 0) { # parent code $jobs{$chld} = $resource; } else { # child code runcmd($resource, $data); exit; # end chld, trigger $SIG{CHLD} } } sleep until @resource == $num_resources; print "ONE ROUND DONE"; last unless @data; print "RELOAD THEN PRESS ENTER: "; <>; }

perl -e'$_="nwdd\x7F^n\x7Flm{{llql0}qs\x14";s/./chr(ord$&^30)/ge;print'

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://349921]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-23 16:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found