magarwal has asked for the wisdom of the Perl Monks concerning the following question:
while (1) { my $remote_paddr = accept(my $remote_socket, SERVER_SOCK); if (!defined(my $pid = fork)) { die "cannot fork: $!"; } elsif ($pid) { next; } # Do some processing, my $myserver = DBIx::MyServer::DBI->new( socket => $remote_socket, dbh => $dbh, banner => $0.' '.join(' ', @ARGV)); # Now launching another child process as, while(1){ if (!defined(my $pid = fork)) { die "cannot fork: $!"; } elsif ($pid) { next; } # Do some processing, # exit second child process _exit(0); } # Exiting the first child process exit; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Killing a child process, kills parent process
by zentara (Cardinal) on Oct 13, 2011 at 17:00 UTC | |
by Marshall (Canon) on Oct 15, 2011 at 11:48 UTC | |
|
Re: Killing a child process, kills parent process
by Marshall (Canon) on Oct 13, 2011 at 15:13 UTC | |
by magarwal (Novice) on Oct 13, 2011 at 17:56 UTC | |
by Marshall (Canon) on Oct 15, 2011 at 11:07 UTC |