Handles signals
@param int $sigNo
482991
public function signalHandler($sigNo)
    {
        if ($this->isMaster) {
            static $stopCount = 0;

            switch ($sigNo) {
                case SIGINT: // Ctrl + C
                case SIGTERM:
                    $sigText = $sigNo === SIGINT ? 'SIGINT' : 'SIGTERM';
                    $this->log("Shutting down(signal:$sigText)...", ProcessLogger::PROC_INFO);
                    $this->stopWork();
                    $stopCount++;

                    if ($stopCount < 5) {
                        $this->stopWorkers();
                    } else {
                        $this->log('Stop workers failed by(signal:SIGTERM), force kill workers by(signal:SIGKILL)', ProcessLogger::PROC_INFO);
                        $this->stopWorkers(SIGKILL);
                    }
                    break;
                case SIGHUP:
                    $this->log('Restarting workers(signal:SIGHUP)', ProcessLogger::PROC_INFO);
                    $this->stopWorkers();
                    break;
                case SIGUSR1: // reload workers and reload handlers
//                    $this->log('Reloading workers and handlers(signal:SIGUSR1)', ProcessLogger::PROC_INFO);
//                    $this->stopWork();
//                    $this->start();
                    break;
                case SIGUSR2:
                    break;
                default:
                    // handle all other signals
            }

        } else {
            $this->stopWork();
            $this->log("Received 'stopWork' signal(signal:SIGTERM), will be exiting.", ProcessLogger::PROC_INFO);
        }
    }
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;
        }
    }
743604
def handler(self, signum, frame):  # pragma: no cover
        ''''''
        if signum == signal.SIGQUIT:
            # QUIT - Finish processing, but don't do any more work after that
            self.stop()
        elif signum == signal.SIGUSR1:
            # USR1 - Print the backtrace
            message = ''.join(traceback.format_stack(frame))
            message = 'Signaled traceback for %s:\n%s' % (os.getpid(), message)
            print(message, file=sys.stderr)
            logger.warn(message)
        elif signum == signal.SIGUSR2:
            # USR2 - Enter a debugger
            # Much thanks to http://stackoverflow.com/questions/132058
            data = {'_frame': frame}    # Allow access to frame object.
            data.update(frame.f_globals)  # Unless shadowed by global
            data.update(frame.f_locals)
            # Build up a message with a traceback
            message = ''.join(traceback.format_stack(frame))
            message = 'Traceback:\n%s' % message
            code.InteractiveConsole(data).interact(message)
483622
protected function handleSignals(): void
    {
        foreach ([SIGTERM, SIGQUIT, SIGABRT, SIGINT] as $signal) {
            pcntl_signal($signal, function ($signal) {
                $this->terminate($signal);
            });
        }
    }
98086
protected function sigHandler($sigNo)
    {
        switch ($sigNo) {
            case SIGTERM:
                exit;

            case SIGHUP:
                break;

            case SIGUSR1:
                $this->readFromIPCSegment();

                $method = $this->internalIPCArray['_call_method'];
                $params = $this->internalIPCArray['_call_input'];

                switch ($this->internalIPCArray['_call_type']) {
                    case -1:
                        $this->$method($params);
                        break;

                    case -2:
                        $this->internalIPCArray['_call_output'] = $this->$method($params);

                        $this->writeToIPCSegment();

                        shmop_write($this->internalSemaphoreKey, 0, 0);
                        shmop_write($this->internalSemaphoreKey, 1, 1);

                        break;
                }
                break;

            default:
                // handle all other signals
        }
    }
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 );
		}
	}
337652
def send_signal(self, signum):
        
        if self._process is None:
            raise RuntimeError('no child process')
        self._process.kill(signum)
337865
public function addSignal($signal, $callback)
    {
        $event = event_new();
        $this->_signalEvents[$signal] = $event;
        event_set($event, $signal, EV_SIGNAL | EV_PERSIST, $callback);
        event_base_set($event, $this->_eventBase);
        event_add($event);
    }
361172
def handle_signal(self, sig, frame):
        """"""
        if sig in [signal.SIGINT]:
            log.warning("Ctrl-C pressed, shutting down...")
        if sig in [signal.SIGTERM]:
            log.warning("SIGTERM received, shutting down...")
        self.cleanup()
        sys.exit(-sig)
656687
public function handleSignal($signo)
    {
        switch ($signo) {
            case \SIGINT:
            case \SIGTERM:
                if (!is_null($this->lastSignal) && $this->lastSignal <= (time() - 5)) {
                    $this->workshop->stopNow();
                } else {
                    $this->lastSignal = time();
                    $this->workshop->stop();
                }
                break;
        }
    }
1319233
public static function handler($iSignal) {

		if (self::$bExit) {
			return;
		}

		switch($iSignal) {
			case SIGTERM:
			case SIGKILL:
			case SIGINT:
				self::$bExit = TRUE;
				break;
			default:
				break;
		}
	}
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;
        }
    }
847124
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\ObjectStateService\DeleteObjectStateGroupSignal) {
            return;
        }

        parent::receive($signal);
    }
1038471
protected function listenForSignals()
    {
        pcntl_async_signals(true);

        pcntl_signal(SIGTERM, function () {
            $this->pendingSignals['terminate'] = 'terminate';
        });

        pcntl_signal(SIGUSR1, function () {
            $this->pendingSignals['restart'] = 'restart';
        });

        pcntl_signal(SIGUSR2, function () {
            $this->pendingSignals['pause'] = 'pause';
        });

        pcntl_signal(SIGCONT, function () {
            $this->pendingSignals['continue'] = 'continue';
        });
    }
1228628
def _sig_handler(self, signum, stack):
        '''
        
        '''
        log_debug("Got SIGINT.")
        if signum == signal.SIGINT:
            LLNetReal.running = False
            if self._pktqueue.qsize() == 0:
                # put dummy pkt in queue to unblock a 
                # possibly stuck user thread
                self._pktqueue.put( (None,None,None) )
539415
public function receive(Signal $signal)
    {
        if (!$signal instanceof Signal\ObjectStateService\CreateObjectStateSignal) {
            return;
        }

        parent::receive($signal);
    }
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);
        }
    }