protected function handleWorkerExit()
    {
        $result = swoole_process::wait();

        if(!empty($this->_noRestartProcesses[$result['pid']])) {
            unset($this->_noRestartProcesses[$result['pid']]);
            return;
        }

        if($result['signal'] > 0) {
            if($this->restartPolicy & self::RESTART_ON_SIGNAL) {
                $this->forkOneWorker();
            }
        } else {
            if($result['code'] > 0) {
                $this->_errors[] = microtime(true);

                if($this->restartPolicy & self::RESTART_ON_ERROR && !$this->_disableRestartOnError) {
                    if($this->tooManyErrors()) {
                        //if exceed the maximum error frequency, stop forking new workers on error
                        $this->_disableRestartOnError = true;
                    } else {
                        $this->forkOneWorker();
                    }
                }
            } else {
                if($this->restartPolicy & self::RESTART_ON_EXIT) {
                    $this->forkOneWorker();
                }
            }
        }
    }