isCurrent() public method

public isCurrent ( ) : boolean
return boolean
示例#1
0
 /**
  *
  * @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;
 }
示例#2
0
 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]);
     }
 }