Set the signal handler to manage_signal (defined in this class)

        Only set handlers for:
        - signal.SIGTERM, signal.SIGINT
        - signal.SIGUSR1, signal.SIGUSR2
        - signal.SIGHUP

        :return: None
979089
def set_signal_handler(self, sigs=None):
        
        if sigs is None:
            sigs = (signal.SIGTERM, signal.SIGINT, signal.SIGUSR1, signal.SIGUSR2, signal.SIGHUP)

        func = self.manage_signal
        if os.name == "nt":  # pragma: no cover, no Windows implementation currently
            try:
                import win32api
                win32api.SetConsoleCtrlHandler(func, True)
            except ImportError:
                version = ".".join([str(i) for i in os.sys.version_info[:2]])
                raise Exception("pywin32 not installed for Python " + version)
        else:
            for sig in sigs:
                signal.signal(sig, func)
1138090
def set_terminate_listeners(stream):
    """"""

    def stop(signum, frame):
        terminate(stream.listener)

    # Installs signal handlers for handling SIGINT and SIGTERM
    # gracefully.
    signal.signal(signal.SIGINT, stop)
    signal.signal(signal.SIGTERM, stop)
1267754
def remove_callback(self, signal_name, callback):
		
		try:
			self.__direct_callbacks[signal_name].remove(callback)
		except KeyError:
			raise ValueError('Signal "%s" does not have the specified callback' % signal_name)
235735
def run(self) -> None:
        
        if self._logging_level:
            logging.basicConfig(
                level=getattr(logging, self._logging_level.upper()),
                format="%(levelname).1s %(name)s.%(funcName)s:%(lineno)d - %(message)s")

        signal.signal(signal.SIGINT, self._handle_sigint)
        signal.signal(signal.SIGTERM, self._handle_sigterm)
        if platform.system() != 'Windows':
            # These features will not be available on Windows, but that is OK.
            # Read this issue for more details:
            # https://github.com/cenkalti/kuyruk/issues/54
            signal.signal(signal.SIGHUP, self._handle_sighup)
            signal.signal(signal.SIGUSR1, self._handle_sigusr1)
            signal.signal(signal.SIGUSR2, self._handle_sigusr2)

        self._started_at = os.times().elapsed

        for t in self._threads:
            t.start()

        try:
            signals.worker_start.send(self.kuyruk, worker=self)
            self._consume_messages()
            signals.worker_shutdown.send(self.kuyruk, worker=self)
        finally:
            self.shutdown_pending.set()
            for t in self._threads:
                t.join()

        logger.debug("End run worker")
904456
def signal(sig)
      sig = sig.to_i if sig.to_i != 0
      applog(self, :info, "#{self.name} sending signal '#{sig}' to pid #{self.pid}")
      ::Process.kill(sig, self.pid) rescue nil
    end
637246
def sigterm_handler(signum, stack_frame):
    
    # pylint: disable-msg=W0613
    global _KILLED

    for name, cmd in _COMMANDS.iteritems():
        if cmd.at_stop:
            LOG.info("at_stop: %r", name)
            cmd.at_stop()

    _KILLED = True

    if _HTTP_SERVER:
        _HTTP_SERVER.kill()
        _HTTP_SERVER.server_close()
16776
def _uninstall_signal_handlers(self):
        
        signal.signal(signal.SIGINT, signal.SIG_DFL)
        signal.signal(signal.SIGTERM, signal.SIG_DFL)
582604
def trap_default_signals
      Signal.trap('INT') do
        puts 'Interrupted. Terminating process...'
        exit
      end
      Signal.trap('HUP') do
        puts 'SIGHUP - Terminating process...'
        exit
      end
      Signal.trap('TERM') do
        puts 'SIGTERM - Terminating process...'
        exit
      end
    end
417390
def _setup_signal_handler(self):
        
        signal.signal(signal.SIGTERM, self._signal_handler)
        signal.signal(signal.SIGINT, self._signal_handler)
        signal.signal(signal.SIGQUIT, self._signal_handler)
447711
def setup_signal_handler(ios_pid = nil, android_pid = nil)
      Signal.trap('INT') do
        Process.kill('INT', ios_pid) unless ios_pid.nil?
        Process.kill('INT', android_pid) unless android_pid.nil?

        # Kill any existing Appium and Selenium processes
        kill_process 'appium'
        kill_process 'selenium'

        # Terminate ourself
        exit 1
      end
    end
171744
def signal_handler(self, *args):
        
        self.user_callback(self.signal, self.user_arg, *args)
1328932
def _install_signal_handlers(self):
        
        def request_stop(signum, frame):
            self._stop_requested = True
            self.log.info('stop requested, waiting for task to finish')
        signal.signal(signal.SIGINT, request_stop)
        signal.signal(signal.SIGTERM, request_stop)
1026535
public function signal_handler_sigint($signal_number)
	{
		// log that we received an exit request
		$this->received_exit_request(true);

		// kill child processes
		if (self::$parent_pid == getmypid())
		{
			foreach ($this->forked_children as $pid => &$pid_info)
			{
				if ($pid_info['status'] == self::STOPPED)
				{
					continue;
				}

				// tell helpers not to respawn
				if ($pid_info['status'] == self::HELPER)
				{
					$pid_info['respawn'] = false;
				}

				$this->safe_kill($pid, SIGINT, 'requesting child exit for pid: ' . $pid, self::LOG_LEVEL_INFO);
			}

			sleep(1);

			// checking for missed sigchild
			$this->signal_handler_sigchild(SIGCHLD);

			$start_time = time();

			// wait for child processes to go away
			while ($this->forked_children_count > 0)
			{
				if (time() > ($start_time + $this->children_max_timeout))
				{
					foreach ($this->forked_children as $pid => $child)
					{
						if ($child['status'] == self::STOPPED)
						{
							continue;
						}

						$this->safe_kill($pid, SIGKILL, 'force killing child pid: ' . $pid, self::LOG_LEVEL_INFO);

						// stop the child
						$this->forked_children[$pid]['status'] = self::STOPPED;
						$this->forked_children_count--;
					}
				}
				else
				{
					$this->log('waiting ' . ($start_time + $this->children_max_timeout - time()) . ' seconds for ' . $this->forked_children_count . ' children to clean up', self::LOG_LEVEL_INFO);
					sleep(1);
					$this->housekeeping_check();
				}
			}

			// make call back to parent exit function if it exists
			$this->invoke_callback($this->parent_function_exit, $parameters = array(self::$parent_pid, $signal_number), true);
		}
		else
		{
			// invoke child cleanup callback
			if (isset($this->child_bucket))
			{
				$this->invoke_callback($this->child_function_exit[$this->child_bucket], $parameters = array($this->child_bucket), true);
			}
		}

		exit(-1);
	}
1059733
def unregister_signal_handlers():
    
    signal.signal(SIGNAL_STACKTRACE, signal.SIG_IGN)
    signal.signal(SIGNAL_PDB, signal.SIG_IGN)
340038
async def addSignalHandlers(self):
        '''
        
        '''

        def sigint():
            self.printf('<ctrl-c>')
            if self.cmdtask is not None:
                self.cmdtask.cancel()

        self.loop.add_signal_handler(signal.SIGINT, sigint)
841295
def signal_handler(sig, frame):
    
    for client in connected_clients[:]:
        if client.is_asyncio_based():
            client.start_background_task(client.disconnect, abort=True)
        else:
            client.disconnect(abort=True)
    return original_signal_handler(sig, frame)
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)