public function exitWorker(int $sig, array $pid): self
    {
        $this->logger->debug('worker ['.$pid['pid'].'] exit with ['.$sig.']', [
            'category' => get_class($this),
        ]);

        pcntl_waitpid($pid['pid'], $status, WNOHANG | WUNTRACED);

        foreach ($this->forks as $id => $process) {
            if ($process === $pid['pid']) {
                unset($this->forks[$id]);

                if (isset($this->job_map[$id])) {
                    unset($this->job_map[$id]);
                }
            }
        }

        $this->spawnMinimumWorkers();
        return $this;
    }
public function exitWorker(int $sig, array $pid): self
    {
        $this->logger->debug('worker ['.$pid['pid'].'] exit with ['.$sig.']', [
            'category' => get_class($this),
        ]);

        pcntl_waitpid($pid['pid'], $status, WNOHANG | WUNTRACED);

        foreach ($this->forks as $id => $process) {
            if ($process === $pid['pid']) {
                unset($this->forks[$id]);

                if (isset($this->job_map[$id])) {
                    unset($this->job_map[$id]);
                }
            }
        }

        $this->spawnMinimumWorkers();
        return $this;
    }
public function exitWorker ( int $ sig , array $ pid ) : self { $ this -> logger -> debug ( 'worker [' . $ pid [ 'pid' ] . '] exit with [' . $ sig . ']' , [ 'category' => get_class ( $ this ) , ] ) ; pcntl_waitpid ( $ pid [ 'pid' ] , $ status , WNOHANG | WUNTRACED ) ; foreach ( $ this -> forks as $ id => $ process ) { if ( $ process === $ pid [ 'pid' ] ) { unset ( $ this -> forks [ $ id ] ) ; if ( isset ( $ this -> job_map [ $ id ] ) ) { unset ( $ this -> job_map [ $ id ] ) ; } } } $ this -> spawnMinimumWorkers ( ) ; return $ this ; }
Wait for child and terminate.
Wait for child and terminate .