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

Re^2: Is fork() my answer to using dual-cpu?

by bluto (Curate)
on Oct 25, 2005 at 19:12 UTC ( [id://502844]=note: print w/replies, xml ) Need Help??


in reply to Re: Is fork() my answer to using dual-cpu?
in thread Is fork() my answer to using dual-cpu?

You'll want that exec to be something like...

exec("shell_script < $input_file") unless $pid;

...since otherwise the parent will exec as well. FWIW, when I use fork() most of the time I write it in the following "template", comments and all ...

my $pid = fork(); die "failed to fork: $!" unless defined $pid; unless ($pid) { # child die; } # parent

... and then fill in the code later. That way it's harder for me to mess it up. :-)

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2024-03-28 07:52 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found