/** * {@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); }
/** * {@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); }