onegative has asked for the wisdom of the Perl Monks concerning the following question:
Somebody please put me out of my misery!#!/usr/bin/perl $SIG{CHLD} = "IGNORE"; $f1="file1.txt"; $f2="file2.txt"; $f3="file3.txt"; $naptime=5; sub count{ print "Starting Fork 1\n"; open(FILE1, ">$f1"); while($x < 10){ $x=$x+1; print FILE1 "$x\n"; sleep($naptime); } close(FILE1); fork && exit; } sub count2{ print "Starting Fork 2\n"; open(FILE2, ">$f2"); while($y < 10){ $y=$y+1; print FILE2 "$y\n"; sleep($naptime); } close(FILE2); fork && exit; } count(); count2(); print "Starting Parent Process\n"; open(FILE3, ">$f3"); while($z < 10){ $z=$z+1; print FILE3 "$z\n"; sleep($naptime); } close(FILE3); print "Parent Script Finished!\n"; ########################################################
update (broquaint): added <code> tags
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: fork() && exit;
by stvn (Monsignor) on Feb 23, 2004 at 16:36 UTC | |
by Abigail-II (Bishop) on Feb 23, 2004 at 17:02 UTC | |
by stvn (Monsignor) on Feb 23, 2004 at 17:09 UTC | |
by onegative (Scribe) on Feb 23, 2004 at 17:15 UTC | |
|
Re: fork() && exit;
by Abigail-II (Bishop) on Feb 23, 2004 at 16:18 UTC | |
by stvn (Monsignor) on Feb 23, 2004 at 17:16 UTC | |
by Abigail-II (Bishop) on Feb 23, 2004 at 17:23 UTC | |
by stvn (Monsignor) on Feb 23, 2004 at 17:46 UTC | |
by stvn (Monsignor) on Feb 23, 2004 at 16:52 UTC | |
by Abigail-II (Bishop) on Feb 23, 2004 at 16:58 UTC | |
|
Re: fork() && exit;
by agentv (Friar) on Feb 23, 2004 at 21:16 UTC |