Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re^2: Multiprocess - child process cannot be finished successfully

by marto (Cardinal)
on Sep 09, 2022 at 09:54 UTC ( [id://11146783]=note: print w/replies, xml ) Need Help??


in reply to Re: Multiprocess - child process cannot be finished successfully
in thread Multiprocess - child process cannot be finished successfully

When you click 'preview' this wouldn't have looked right.

<code> #!/usr/bin/perl </code>

PerlMonks for the Absolute Beginner/How do I post a question effectively?.

  • Comment on Re^2: Multiprocess - child process cannot be finished successfully
  • Download Code

Replies are listed 'Best First'.
Re^3: Multiprocess - child process cannot be finished successfully
by wonderG (Novice) on Sep 09, 2022 at 10:00 UTC
    for (my $index=0; $index <= $#$array; $index++){ defined(my $pid = fork) or die "fork failed: $!"; unless( defined($pid) ) { flock $logfile, LOCK_EX; print $logfile "OK $!\n"; flock $logfile, LOCK_UN; } unless($pid) { # child print "child: $$\n"; eval { ....... }; if( $@ ) { flock $logfile, LOCK_EX; print $logfile "ok"; flock $logfile, LOCK_UN; } unless( .. ) { flock $logfile, LOCK_EX; print $logfile "ok"; flock $logfile, LOCK_UN; else { flock $fh, LOCK_EX; print $fh "ok"; flock $fh, LOCK_UN; } close($fh); close($logfile); exit; # exit child process } if(wait() == -1){ print "Parent Process"; close($fh); # Close file handler $fh close($logfile); # Close file handler $logfile rename ($oldfilename, $newfilename) or die "Error in renaming $!"; + alarm(0); } }

Log In?
Username:
Password:

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

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

    No recent polls found