4. Ctrl+Cを押しても止まらないプログラムCで書くとvoid sigint_handler(intsigno) {printf("received SIGINT");}void main() { signal(SIGINT, sigint_handler); for (;;) { sleep(1); }} 5. シグナルの使い方Pythonではdefsigint_handler(signo, frame): print "received SIGINT"import signalsignal.signal(signal.SIGINT, sigint_handler)while True:signal.pause()
![Pythonのシグナル処理](https://cdn-ak-scissors.b.st-hatena.com/image/square/684393b5a7ce240da059f5c7738b52ad409519d0/height=288;version=1;width=512/https%3A%2F%2Fcdn.slidesharecdn.com%2Fss_thumbnails%2Fpython-111015034101-phpapp01-thumbnail.jpg%3Fwidth%3D640%26height%3D640%26fit%3Dbounds)