프로그램/Python
python timeout (only linux)
ex) import signal import time def log_print() : count = 1 while 1: print ("count : ", count) count = count + 1 time.sleep(1) class timeout: def __init__(self, seconds=1, error_message='Timeout'): self.seconds = seconds self.error_message = error_message def handle_timeout(self, signum, frame): raise TimeoutError(self.error_message) def __enter__(self): signal.signal(signal.SIGALRM, self.handle_t..
2018. 12. 18. 11:51