public function kill($wait = false)
    {
		if ($this->simulation) {
			$this->state = self::TERMINATED;
			return true;
		}

        if (!is_dir('/proc/'.$this->pid))
            return null;

        $this->state = self::TERMINATING;

        if (!posix_kill($this->pid, SIGKILL))
            return false;

        if ($wait) {
            pcntl_waitpid($this->pid, $status);
            $this->state = self::TERMINATED;
        } else {
            if (!is_dir('/proc/'.$this->pid))
                $this->state = self::TERMINATED;
        }
        return true;
    }
public function kill($wait = false)
    {
		if ($this->simulation) {
			$this->state = self::TERMINATED;
			return true;
		}

        if (!is_dir('/proc/'.$this->pid))
            return null;

        $this->state = self::TERMINATING;

        if (!posix_kill($this->pid, SIGKILL))
            return false;

        if ($wait) {
            pcntl_waitpid($this->pid, $status);
            $this->state = self::TERMINATED;
        } else {
            if (!is_dir('/proc/'.$this->pid))
                $this->state = self::TERMINATED;
        }
        return true;
    }
public function kill ( $ wait = false ) { if ( $ this -> simulation ) { $ this -> state = self :: TERMINATED ; return true ; } if ( ! is_dir ( '/proc/' . $ this -> pid ) ) return null ; $ this -> state = self :: TERMINATING ; if ( ! posix_kill ( $ this -> pid , SIGKILL ) ) return false ; if ( $ wait ) { pcntl_waitpid ( $ this -> pid , $ status ) ; $ this -> state = self :: TERMINATED ; } else { if ( ! is_dir ( '/proc/' . $ this -> pid ) ) $ this -> state = self :: TERMINATED ; } return true ; }
Stops a worker and kills the process
@param boolean $wait If true, this method will hold execution till the process end
@return boolean Null, if worker is not active. False, if signal can't be sent to worker.
True, if signal sent OR signal sent and worker terminated (if $wait = true).
Stops a worker and kills the process