Artificial intelligent assistant

Python でのシグナルハンドラ内の処理 Python signal I/O `kill -TERM <PID>` `handler()` import signal import time import os def handler(num, frame): print("handler") # do something signal.signal(signal.SIGTERM, handler) print("sleep... {0}".format(os.getpid())) time.sleep(60) signal Linux21 > 2 (p.444) I/O : import signal import threading import time import os event = threading.Event() def funcA(): print("start funcA") event.wait() print("end funcA") def handler(num, frame): print("handler") event.set() signal.signal(signal.SIGTERM, handler) th = threading.Thread(target = funcA) th.start() print("sleep... {0}".format(os.getpid())) time.sleep(60)

> > 2 (p.444)

()()

<
<

()

> Python (C)

Python

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy ff12d869771a4a87cac5f9f9bb878f63