if(my $pid=fork){ while(my $c = ReadKey){ #doing something... ; } kill( HUP => $pid ); wait(0); } else { my $count = 0; while(1){ sleep(1); print $count++; } }
if(my $pid=fork){ #parent my $run = 1; $SIG{CHLD} = sub { $deadchildpid = wait; $run = 0 }; my $count = 0; while($run){ sleep(1); print $count++; } } else { #child while(my $c = ReadKey){ #doing something... ; } }
In reply to Re: Parent process finished. How to exit the child process.
by spazm
in thread Parent process finished. How to exit the child process.
by ybnormal
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |