/** * * @return Process */ public static function current() { $pid = \posix_getpid(); if (!self::$_current || !self::$_current->isCurrent()) { self::$_current = new Process($pid, \posix_getppid()); } return self::$_current; }
public function stop() { if (!$this->_currentProcess->isCurrent()) { return; } $this->_stoped = true; foreach ($this->_children as $stub) { try { $stub->getProcess()->kill(); } catch (\Exception $ex) { Logger::err('fail to kill process', array('exception' => $ex)); } } while (count($this->_children)) { $status = 0; $pid = \pcntl_wait($status); unset($this->_children[$pid]); } }