Show
Ignore:
Timestamp:
04/04/08 17:44:49 (6 years ago)
Author:
kazuho
Message:

don't delay if worker process was killed by parent

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/Parallel-Prefork/trunk/lib/Parallel/Prefork.pm

    r8854 r8876  
    2424        signal_received      => '', 
    2525        manager_pid          => undef, 
     26        generation           => 0, 
    2627        %$opts, 
    2728    }, $klass; 
     
    3738    $self->manager_pid($$); 
    3839    $self->signal_received(''); 
     40    $self->{generation}++; 
    3941     
    4042    die 'cannot start another process while you are in child process' 
     
    5759                return; 
    5860            } 
    59             $self->{worker_pids}{$pid} = 1; 
     61            $self->{worker_pids}{$pid} = $self->{generation}; 
    6062        } 
    6163        if (my ($exit_pid, $status) = wait3(! $pid)) { 
    62             delete $self->{worker_pids}{$exit_pid}; 
    63             unless ($status == 0) { 
     64            if (delete($self->{worker_pids}{$exit_pid}) == $self->{generation} 
     65                    && $status != 0) { 
    6466                sleep $self->err_respawn_interval; 
    6567            }