コード例 #1
0
ファイル: SignalAlarm.php プロジェクト: Esysteme/Process
 /**
  * {@inheritDoc}
  */
 public function __invoke($signal)
 {
     $this->context->exitCode = 3;
     $this->context->finishTime = time();
     $this->action->trigger(Action::EVENT_TIMEOUT, $this->control, $this->context);
     $this->control->quit($this->context->exitCode);
 }
コード例 #2
0
ファイル: Child.php プロジェクト: jamiefifty/Process
 /**
  * {@inheritdoc}
  */
 public function start()
 {
     if ($this->hasId() && $this->isRunning()) {
         throw new RuntimeException('Process already started');
     }
     $this->context->processId = $this->control->fork();
     $this->context->isRunning = true;
     if ($this->context->processId > 0) {
         $this->action->trigger(Action::EVENT_FORK, $this->control, $this->context);
         return;
     }
     $this->context->processId = $this->control->info()->getId();
     $this->context->startTime = time();
     $this->setHandlerAlarm();
     $this->setHandlerErrorException();
     $this->run();
     restore_error_handler();
     $this->control->quit($this->context->exitCode);
 }