def monitor(self, timeout):
        """
        Monitor the process, check whether it runs out of time.
        """

        def check(self, timeout):
            time.sleep(timeout)
            self.stop()
        wather = threading.Thread(target=check)
        wather.setDaemon(True)
        wather.start()
Monitor the process, check whether it runs out of time.