Receive the given $signal and react on it.

@param \eZ\Publish\Core\SignalSlot\Signal $signal
772204
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\LocationService\UnhideLocationSignal) {
            return;
        }

        $this->indexSubtree($signal->locationId);
    }
349135
public function handleSignal(int $signal) {
        $this->log(LogLevel::DEBUG, "[{pid}] Caught signal '{$signal}'");

        switch ($signal) {

            // Daemon was asked to hang up
            case SIGHUP:
                if ($this->realm == 'daemon') {
                    $handled = $this->payloadExec('signal', [$signal]);
                    if (!$handled) {
                        throw new Exception("Restart", 100);
                    }
                }
                break;

            // Daemon is exiting, kill children
            case SIGINT:
            case SIGTERM:
                if ($this->realm == 'daemon') {
                    if ($this->instance) {
                        if (is_callable([$this->instance, 'shutdown'])) {
                            $this->instance->shutdown();
                        }
                    }
                    $this->reapAllChildren();
                    $this->payloadExec('signal', [$signal]);
                    throw new Exception("Shutdown", 200);
                }
                break;

            // Child process exited
            case SIGCHLD:
                if ($this->realm == 'daemon') {
                    do {
                        $status = null;
                        $pid = pcntl_wait($status, WNOHANG);
                        if ($pid > 0) {
                            $this->reapChild($pid, $status);
                        }
                    } while ($pid > 0);

                    //$pid = pcntl_waitpid(-1, $status, WNOHANG);
                    //if ($pid > 0)
                    //   $this->land($pid, $status);
                }
                break;

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

            // Custom signal - Nothing
            case SIGUSR2:
                $this->payloadExec('signal', [$signal]);
                break;
        }
    }
232673
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\LocationService\CreateLocationSignal) {
            return;
        }

        $this->runLegacyKernelCallback(
            static function () use ($signal) {
                eZContentCacheManager::clearContentCacheIfNeeded($signal->contentId, true, [$signal->locationId]);
                $object = eZContentObject::fetch($signal->contentId);
                eZSearch::addNodeAssignment($object->mainNodeID(), $signal->contentId, $signal->locationId);
                eZContentObject::clearCache(); // Clear all object memory cache to free memory
            }
        );
    }
707893
public static function signalHandler($signal)
    {
        switch ($signal) {
            // Stop.
            case SIGINT:
                self::stopAll();
                break;
            // Reload.
            case SIGUSR1:
                self::$_pidsToRestart = self::getAllWorkerPids();
                self::reload();
                break;
            // Show status.
            case SIGUSR2:
                self::writeStatisticsToStatusFile();
                break;
        }
    }
404966
public function emit($signal, $params = null)
  {
    if(!$this->hasHandlers($signal))
    {
      return;
    }

    if(!is_array($params))
    {
      $params = func_get_args();
      $params = array_slice($params, 1);
    }

    foreach($this->sigslots[$signal] as $slot)
    {
      $return = $slot->call($params);
    }

    return $return;
  }
1191392
public function signalReceived($signal)
    {
        if ($signal === 'submit') {
            if (!$this->getPresenter()->getRequest()->hasFlag(Nette\Application\Request::RESTORED)) {
                $this->fireEvents();
            }
        } else {
            $class = get_class($this);
            throw new BadSignalException("Missing handler for signal '$signal' in $class.");
        }
    }
760872
public function handleSignal($signal)
    {
        switch ($signal) {
        case SIGINT:
            $this->log(
                'Received SIGINT, shutting down.' . PHP_EOL,
                Net_Notifier_Logger::VERBOSITY_ALL
            );
            $this->moribund = true;
            break;

        case SIGTERM:
            $this->log(
                'Received SIGTERM, shutting down.' . PHP_EOL,
                Net_Notifier_Logger::VERBOSITY_ALL
            );
            $this->moribund = true;
            break;
        }
    }
1354196
public static function signal($signals, $callback)
    {
        foreach ($signals as $signal) {
            if (is_null($callback)) {
                \Swoole\Process::signal($signal, null);
                continue;
            }
            \Swoole\Process::signal($signal, function ($signal) use ($callback) {
                try {
                    call_user_func($callback, $signal);
                } catch (\Throwable $e) {
                    \Mix::$app->error->handleException($e);
                }
            });
        }
    }
776670
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\UserService\UnAssignUserFromUserGroupSignal) {
            return;
        }

        $this->runLegacyKernelCallback(
            static function () {
                eZContentCacheManager::clearAllContentCache();
                eZRole::expireCache();
            }
        );
    }
152729
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\ContentTypeService\PublishContentTypeDraftSignal) {
            return;
        }

        $this->runLegacyKernelCallback(
            static function () use ($signal) {
                eZExpiryHandler::registerShutdownFunction();
                $handler = eZExpiryHandler::instance();
                $time = time();
                $handler->setTimestamp('user-class-cache', $time);
                $handler->setTimestamp('class-identifier-cache', $time);
                $handler->setTimestamp('sort-key-cache', $time);
                $handler->store();
            }
        );
    }
920459
protected function stop_children($signal=SIGTERM) {
        $this->log("Stopping children", GearmanManager::LOG_LEVEL_PROC_INFO);

        foreach ($this->children as $pid=>$child) {
            $this->log("Stopping child $pid (".implode(",", $child['job']).")", GearmanManager::LOG_LEVEL_PROC_INFO);
            posix_kill($pid, $signal);
        }

    }
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);
        }
    }
869502
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\UserService\DeleteUserSignal) {
            return;
        }

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

        // Delete locations if there is any
        foreach ($signal->affectedLocationIds as $locationId) {
            $this->searchHandler->deleteLocation($locationId, $signal->userId);
        }
    }
886834
public function kill($signal = SIGKILL)
    {
        if (!$this->getPid()) {
            throw new ResqueRuntimeException(
                'Cannot kill a process with out a pid set'
            );
        }

        //TODO: needs logger
        //$this->getLogger()->notice('Sending {signal} to process {pid}', array('signal'=>$signal, 'pid'=>$this->getPid()));

        // @todo Work out if I care to check the result, and if I did what to do about it... Exception?
        posix_kill($this->getPid(), $signal);

        $this->pid = null;

        return $this;
    }
262238
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\LocationService\CreateLocationSignal) {
            return;
        }

        $this->client->updateContent($signal->contentId);
    }
671262
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\ContentService\RevealContentSignal) {
            return;
        }

        $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($signal->contentId);
        foreach ($locations as $location) {
            $this->indexSubtree($location->id);
        }
    }
238007
public function removeSignal($signal)
    {
        if (isset($this->_signalEvents[$signal])) {
            $event = $this->_signalEvents[$signal];
            event_del($event);
            unset($this->_signalEvents[$signal]);
        }
    }