Python signal 模块,SIGTTOU 实例源码

我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用signal.SIGTTOU

项目:bitmask-dev    作者:leapcode    | 项目源码 | 文件源码
def make_default_signal_map():
    """ Make the default signal map for this system.

        :return: A mapping from signal number to handler object.

        The signals available differ by system. The map will not contain
        any signals not defined on the running system.

        """
    name_map = {
        'SIGTSTP': None,
        'SIGTTIN': None,
        'SIGTTOU': None,
        'SIGTERM': 'terminate',
    }
    signal_map = dict(
        (getattr(signal, name), target)
        for (name, target) in name_map.items()
        if hasattr(signal, name))

    return signal_map
项目:python-application    作者:AGProjects    | 项目源码 | 文件源码
def _setup_signal_handlers(self):
        """Setup the signal handlers for daemon mode"""
        signals = self.signals
        # Ignore Terminal I/O Signals
        if hasattr(signal, 'SIGTTOU'):
            signals.ignore(signal.SIGTTOU)
        if hasattr(signal, 'SIGTTIN'):
            signals.ignore(signal.SIGTTIN)
        if hasattr(signal, 'SIGTSTP'):
            signals.ignore(signal.SIGTSTP)
        # Ignore USR signals
        if hasattr(signal, 'SIGUSR1'):
            signals.ignore(signal.SIGUSR1)
        if hasattr(signal, 'SIGUSR2'):
            signals.ignore(signal.SIGUSR2)