listen/signal_handler.py
def pause(self, signum, seconds=0, callback_function=None):
        """
        Pause execution, execution will resume in X seconds or when the
        appropriate resume signal is received. Execution will jump to the
        callback_function, the default callback function is the handler
        method which will run all tasks registered with the reg_on_resume
        methodi.
        Returns True if timer expired, otherwise returns False
        """
        if callback_function is None:
            callback_function = self.default_handler
        if seconds > 0:
            self.log.info("Signal handler pausing for {0} seconds or until it receives SIGALRM or SIGCONT".format(seconds))
            signal.signal(signal.SIGALRM, callback_function)
            signal.alarm(seconds)
        else:
            self.log.info('Signal handler pausing until it receives SIGALRM or SIGCONT')
        signal.signal(signal.SIGCONT, callback_function)
        signal.pause()
        self.log.info('Signal handler resuming from pause')
        if signum == signal.SIGALRM:
            return True
        else:
            return False
def pause(self, signum, seconds=0, callback_function=None):
        """
        Pause execution, execution will resume in X seconds or when the
        appropriate resume signal is received. Execution will jump to the
        callback_function, the default callback function is the handler
        method which will run all tasks registered with the reg_on_resume
        methodi.
        Returns True if timer expired, otherwise returns False
        """
        if callback_function is None:
            callback_function = self.default_handler
        if seconds > 0:
            self.log.info("Signal handler pausing for {0} seconds or until it receives SIGALRM or SIGCONT".format(seconds))
            signal.signal(signal.SIGALRM, callback_function)
            signal.alarm(seconds)
        else:
            self.log.info('Signal handler pausing until it receives SIGALRM or SIGCONT')
        signal.signal(signal.SIGCONT, callback_function)
        signal.pause()
        self.log.info('Signal handler resuming from pause')
        if signum == signal.SIGALRM:
            return True
        else:
            return False
Pause execution, execution will resume in X seconds or when the
        appropriate resume signal is received. Execution will jump to the
        callback_function, the default callback function is the handler
        method which will run all tasks registered with the reg_on_resume
        methodi.
        Returns True if timer expired, otherwise returns False