Worker signal handler

@param int $signal
@throws Exception
341306
public function workerSignal(int $signal) {
        $this->log(LogLevel::DEBUG, "[{pid}] Caught signal '{$signal}' (SIGHUP) at worker - handing off to payload handler");

        switch ($signal) {

            // Daemon was asked to hang up
            case SIGHUP:
                $this->payloadExec('signal', [$signal]);
                break;

            // Custom signal - Nothing
            case SIGUSR1:
                $this->payloadExec('signal', [$signal]);
                break;

            // Custom signal - Nothing
            case SIGUSR2:
                $this->payloadExec('signal', [$signal]);
                break;
        }
    }
583521
protected function sendSignal($signal)
    {
        try {
            $this->process->signal($signal);
        } catch (ExceptionInterface $e) {
            if ($this->process->isRunning()) {
                throw $e;
            }
        }
    }
539415
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\ObjectStateService\CreateObjectStateSignal) {
            return;
        }

        parent::receive($signal);
    }
945933
protected function reportWorkerError($workerId, $workerPid, $exitCode, $signal)
    {
        $this->handleException(new WorkerExitUnexpectedException(sprintf(
            'The worker %d quit unexpected with exit code %d, signal %d, pid %d.',
            $workerId, $exitCode, $signal, $workerPid
        )));
    }
211280
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\LocationService\CopySubtreeSignal) {
            return;
        }

        $this->indexSubtree($signal->targetNewSubtreeId);
    }
421489
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\ContentService\CopyContentSignal) {
            return;
        }

        $this->searchHandler->indexContent(
            $this->persistenceHandler->contentHandler()->load(
                $signal->dstContentId,
                $signal->dstVersionNo
            )
        );

        $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent(
            $signal->dstContentId
        );
        foreach ($locations as $location) {
            $this->searchHandler->indexLocation($location);
        }
    }
787779
public function signalHandler($signal)
    {
        $this->emit('signal', $signal);
        $this->emit($signal);

        // Default signal process
        if ($this->options['catch_signal']) {
            $this->signalHandlerDefault($signal);
        }
    }
1310439
public function killAll($signal = SIGINT)
    {
        foreach ($this->forks as $fork) {
            $fork->kill($signal);
        }
    }
889907
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\UserService\DeleteUserGroupSignal) {
            return;
        }

        // Delete Content
        $this->searchHandler->deleteContent($signal->userGroupId);

        // Delete locations if there is any
        foreach ($signal->affectedLocationIds as $locationId) {
            $this->searchHandler->deleteLocation($locationId, $signal->userGroupId);
        }
    }
1286388
public function getHandlers($signal)
    {
        $signalNumber = $this->translateSignal($signal);
        $handlers = [];
        if (isset($this->handlers[$signalNumber])) {
            $handlers = $this->handlers[$signalNumber];
        }

        return $handlers;
    }
984920
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\SectionService\AssignSectionSignal) {
            return;
        }

        $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($signal->contentId);
        $this->searchHandler->indexContent(
            $this->persistenceHandler->contentHandler()->load($contentInfo->id, $contentInfo->currentVersionNo)
        );
    }
373049
public function emit($signal, $args = null)
    {
        if ($this->signalsBlocked) {
            return;
        }

        if (isset($this->signals[$signal]) === false) {
            return;
        }

        /* @var $slots MSlot[] */
        $slots = $this->signals[$signal];

        foreach ($slots as /* @var $slot MSlot */
                 $slot) {
            $method = $slot->getMethod();
            $object = $slot->getReceiver();

            if ($args == null) {
                if ($object == null) {
                    $method();
                } else {
                    $object->$method();
                }
            } else {
                if ($object == null) {
                    $method($args);
                } else {
                    $object->$method($args);
                }
            }
        }
    }
1087090
public static function signalHandler($signal)
    {
        switch ($signal) {
            // Stop.
            case SIGINT:
                static::$_gracefulStop = false;
                static::stopAll();
                break;
            // Graceful stop.
            case SIGTERM:
                static::$_gracefulStop = true;
                static::stopAll();
                break;
            // Reload.
            case SIGQUIT:
            case SIGUSR1:
                if($signal === SIGQUIT){
                    static::$_gracefulStop = true;
                }else{
                    static::$_gracefulStop = false;
                }
                static::$_pidsToRestart = static::getAllWorkerPids();
                static::reload();
                break;
            // Show status.
            case SIGUSR2:
                static::writeStatisticsToStatusFile();
                break;
            // Show connection status.
            case SIGIO:
                static::writeConnectionsStatisticsToStatusFile();
                break;
        }
    }
71988
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\LocationService\HideLocationSignal) {
            return;
        }

        $this->runLegacyKernelCallback(
            static function () use ($signal) {
                $node = eZContentObjectTreeNode::fetch($signal->locationId);
                eZContentObjectTreeNode::clearViewCacheForSubtree($node);
                eZSearch::updateNodeVisibility($signal->locationId, 'hide');
                eZContentObject::clearCache(); // Clear all object memory cache to free memory
            }
        );
    }
1106210
public function broadcast($signal) {
        if ($signal == SIGINT || $signal == SIGKILL) {
            $this->isStopped = true;
        }
        foreach ($this->handlers as $handler) {
            posix_kill($handler, $signal);
        }
    }
60834
function signalHandler(signal)
{
    var exit = true;
    cleanupHandlers.forEach(function (cleanup) {
        if (cleanup(null, signal) === false)
            exit = false;
    });
    if (exit) {
        if (signal === 'SIGINT' && messages && messages.ctrl_C !== '')
            process.stderr.write(messages.ctrl_C + "\n");
        uninstall(); // don't cleanup again
        // necessary to communicate the signal to the parent process
        process.kill(process.pid, signal);
    }
}
1331620
public function stop($signal = SIGKILL, $wait = false)
    {
        if ($this->isAlive()) {
            posix_kill($this->_pid, $signal);
            if ($wait) {
                pcntl_waitpid($this->_pid, $status = 0);
            }
        }
    }