Sends a signal to the current process and returns its results.

@param int $signalNumber

@return bool
323552
protected function sendSignal($signalNumber)
    {
        if (! $this->context->isRunning || ! $this->context->processId) {
            return false;
        }

        $result = $this->control->signal()->send($signalNumber, $this->context->processId);
        if (in_array($signalNumber, [SIGTERM, SIGKILL])) {
            $this->context->isRunning = false;
            $this->context->processId = null;
        }

        return $result;
    }
147430
public function kill($signal = SIGTERM)
    {
        if (!$this->isAlive()) {
            return false;
        }

        if (!proc_terminate($this->resource, $signal)) {
            return false;
        }

        $this->setStreamBlocking();

        while ($this->isAlive()) {
            usleep(50000);
        }

        $this->cleanup();
        return true;
    }
306470
protected function handleSignal( $signalNumber )
	{
		switch( $signalNumber )
		{
			case SIGTERM:
				$this->signalTerm = TRUE;
				@unlink( $this->filePid );
				break;
			case SIGHUP:
				$this->signalHangup = TRUE;
				break;
			default:
				$this->report( 'Funny signal: ' . $signalNumber );
		}
	}
373101
public static function Listen($signal_type, $callback, $priority = 10)
    {
        if(!isset(self::$listeners[$signal_type]))
            self::$listeners[$signal_type] = array();

        self::$listeners[$signal_type][] = array(
            'callback' => $callback,
            'priority' => $priority
        );

        self::$listeners[$signal_type] = self::Sort(
            self::$listeners[$signal_type], 'priority'
        );
    }
796150
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\ContentService\DeleteContentSignal) {
            return;
        }

        $this->runLegacyKernelCallback(
            static function () use ($signal) {
                eZContentCacheManager::clearContentCacheIfNeeded($signal->contentId);
                eZSearch::removeObjectById($signal->contentId, null);
                eZContentObject::clearCache(); // Clear all object memory cache to free memory
            }
        );
    }
73733
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\ContentService\DeleteContentSignal) {
            return;
        }

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

        // Delete locations if there is any
        foreach ($signal->affectedLocationIds as $locationId) {
            $this->searchHandler->deleteLocation($locationId, $signal->contentId);
        }
    }
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();
            }
        );
    }
245487
public function executeListener($signal, $exit = true)
    {
        $return = null;

        if (isset($this->listeners[$signal])) {
            $return = call_user_func_array($this->listeners[$signal], [$signal]);
        }

        if (true === $exit) {
            // exit the application
            posix_kill(posix_getpid(), SIGKILL);
        }

        return $return;
    }
583521
protected function sendSignal($signal)
    {
        try {
            $this->process->signal($signal);
        } catch (ExceptionInterface $e) {
            if ($this->process->isRunning()) {
                throw $e;
            }
        }
    }
1119008
public static function sendSignal($pid, $signal, $timeout = 0)
    {
        if ($pid <= 0) {
            return false;
        }

        // do send
        if ($ret = posix_kill($pid, $signal)) {
            return true;
        }

        // don't want retry
        if ($timeout <= 0) {
            return $ret;
        }

        // failed, try again ...

        $timeout = $timeout > 0 && $timeout < 10 ? $timeout : 3;
        $startTime = time();

        // retry stop if not stopped.
        while (true) {
            // success
            if (!$isRunning = @posix_kill($pid, 0)) {
                break;
            }

            // have been timeout
            if ((time() - $startTime) >= $timeout) {
                return false;
            }

            // try again kill
            $ret = posix_kill($pid, $signal);
            usleep(10000);
        }

        return $ret;
    }
1081552
public function isActive()
    {
        $pid = $this->getProcessId();
        if (null === $pid) {
            return false;
        }

        return $this->control->signal()->send(0, $pid);
    }
355171
public function signalHandler($sigNo)
    {
        switch ($sigNo) {
            case SIGINT: // Ctrl + C
            case SIGTERM:
                $sigText = $sigNo === SIGINT ? 'SIGINT(Ctrl+C)' : 'SIGTERM';
                $this->log("Shutting down($sigNo:$sigText)...", ProcessLogger::PROC_INFO);
                $this->stopWork();
                break;
            default:
                // handle all other signals
        }
    }
302359
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\ContentService\PublishVersionSignal) {
            return;
        }

        $this->searchHandler->indexContent(
            $this->persistenceHandler->contentHandler()->load($signal->contentId, $signal->versionNo)
        );

        $locations = $this->persistenceHandler->locationHandler()->loadLocationsByContent($signal->contentId);
        foreach ($locations as $location) {
            $this->searchHandler->indexLocation($location);
        }
    }
303816
def send_signals(self):
        """"""
        if self.flag:
            invalid_ipn_received.send(sender=self)
            return
        else:
            valid_ipn_received.send(sender=self)
337652
def send_signal(self, signum):
        
        if self._process is None:
            raise RuntimeError('no child process')
        self._process.kill(signum)
62900
public function commit()
    {
        $return = $this->repository->commit();

        if ($this->signalDispatcher instanceof TransactionHandler) {
            $this->signalDispatcher->commit();
        }

        return $return;
    }
547594
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\ContentService\UpdateContentMetadataSignal) {
            return;
        }

        $contentInfo = $this->persistenceHandler->contentHandler()->loadContentInfo($signal->contentId);
        if (!$contentInfo->isPublished) {
            return;
        }
        $this->searchHandler->indexContent(
            $this->persistenceHandler->contentHandler()->load($contentInfo->id, $contentInfo->currentVersionNo)
        );
        $this->searchHandler->indexLocation($this->persistenceHandler->locationHandler()->load($contentInfo->mainLocationId));
    }