Cannot kill Python script with Ctrl-C

前端 未结 4 950
醉酒成梦
醉酒成梦 2020-11-27 10:56

I am testing Python threading with the following script:

import threading

class FirstThread (threading.Thread):
    def run (self):
        while True:
             


        
4条回答
  •  离开以前
    2020-11-27 11:46

    KeyboardInterrupt and signals are only seen by the process (ie the main thread)... Have a look at Ctrl-c i.e. KeyboardInterrupt to kill threads in python

提交回复
热议问题